alias
===
alias os=’echo $ORACLE_HOME’
alias rm=’rm -i’
to use rm as is normally defined use:
 ”rm a.a # two single quotes OR
 \rm
unalias rm

ls
=
ls -F          # dir1/ file1 link1@ pipe1|
ls -d or ls -1 or ls -1d
ls -h          # size
ls -1S        # largest to smallest

xargs
===
use xargcs to execute commands
wc -l `file * | grep ASCII | cut -d”:” -f1 | grep ASCII | cut -d”:” -f1`
same as
file * | grep ASCII | cut -d”:” -f1 | xargs wc -l

ls | xargs -t -i mv {} {}.bak                             # rename all files in a directory, 
                                                                  # -t=print command before executing,
                                                                  #  -i=replace {} with the item name.
file * | grep ASCII | cut -d”:” -f1 | xargs vi         # opens files one by one for editing
file * | grep ASCII | cut -d”:” -f1 | xargs -p vi     # -p confirm before rrunning each command

file * | grep SSSSS | cut -d”:” -f1 | xargs -t -r wc -l   # -r stops the command if nothing to execute
file * | grep a | cut -d”:” -f1 | xargs -t -r -n2 wc -l   # -n2 stops the command after executing with 2 inputs (even if there are > 2)

rename
====
rename .log .log.`date +%F-%H:%M:%S` *

find
===
find . -name “file*”
find . -iname “file*”                           # -i case insensitive
find . -name “orapw*” -type f             # regular files are type f

find . -name “*oraenv*” -type f -exec file {} \;

find . -name “sqlplus*” -ok {} \;

find . -name “*.trc” -ctime +3 -exec rm {} \;
find . -name “*.trc” -ctime +3 -exec rm -f {} \;
find . -name “*.trc” -ctime +3 -exec ls -l {} \;

m4
==
$cat temp
the COLOR fox jumped over the TYPE fence.
$m4 -DCOLOR=brown -DTYPE=broken temp
$cat temp
the brown fox jumped over the broken fence.

whence and which
===========
which sqlplus                                       # serches PATH for the image and prints the first path or an error
whence sqlplus                                    # serches PATH for the image and prints the first path or does nothing
which -i ls                                            # also displays alias if found
which -a sqlplus                                   # serches PATH for the image and prints all paths found

e.g.
RC=`whence myexec`
If [ $RC -ne “0” ]; then
  echo “myexec is not in the $PATH”
fi

skill snice
======
skill -STOP 16514                      # freeze the process
skill -STOP oracle                       # freeze all oracle user processes
skill -STOP rman                        # freeze all rman processes
skill -STOP -c oracle                    # freeze all commands called oracle
skill -CONT 16514                      # restart process 16514
snice +4 -u oracle                      # drop priority of processes of “oracle” by four points. (higher number, lower priority)