Blog

set the console title

echo -n "\033]0;'TEXT FOR TITLE'\007"

If you put this in a script and call the script you need to source it into the current shell, e.g. . title.sh "my new title"


redirect output to email

<commandf>   2>&1|/usr/ucb/mail -s "Equity Swaps Mail" sleonard



# We want to ensure that program exits with 0 exit status
trap 'exit 0' EXIT TERM HUP QUIT INT



shows how long a cjob has run for

usage:
/usr/bin/time <command> [command arguments..]



convert to lower case (ksh)
echo Test | dd conv=lcase

or ucase



find and remove files over 15 days old
/usr/bin/find /home/creddev/data -mtime +15 -type f -follow  -exec /usr/bin/rm -f {} \;

 



redirect errors to same file
<cmd> > file 2>&1



email files
sed 's/,/ /g' /tmp/T_Swap_RiskManPositions.$$ | sed 's/ /,/g' | uuencode T_Swap_RiskManPositions${date}.csv >> /tmp/mail_swaps.$$

/usr/ucb/mail -s "Swap position file for $date" $MAILLIST < /tmp/mail_swaps.$$



Number of CPUs
/usr/sbin/psrinfo -v
/usr/platform/`uname -i`/sbin/prtdiag -v
/usr/bin/mpstat



see what servers are available
ypcat host2.byname|grep rsk
ping <name>



redirect to isql
/usr/local/sybase/bin/isql -Ucridba -Pcridba  -SCREDIT_TEST << !

PRINT "TRUNCATING exposures TABLE"
use exposures
go
truncate table exposures
go
!



Change delete key
stty erase ^H



DEFAULT_DBTRACE=<log file location>
output all SQL transactions

sp_lock
can give details of processes locking DB
sp_who
can give pid of processes that are blocking DB



Process Running
ps -auxww

ps -ef



redirect unix mail
create file .forward with write access only for me and inside write the email address to redirect to