Some useful UNIX commands and small scripts for SAP Admins:
These are pretty basic but for me they are very useful to look at in a rush moment. I hope they help you too: Lets say you have list of tar files to extract in /usr/sap/put/data file: At the target dir: for i in `ls /usr/sap/put/|grep -v data` do tar -xvf $i done You can use any command within for loop: SAPCAR -xvf /usr/sap/trans/$i If you want to process every single line in a file: pcheck: (params has list of parameters) for i in `cat params` do cat initBWD.ora|grep $i >> params_out for i in `cat params_out` do cat initBWD.ora|grep $i done PS: � (single quota) string comes out ` (tick) command result comes out. Produce a CDLIST file with the contents of CDLABEL.ASC in several directories: # for i in `ls /sapcd/dvd*/CDLABEL.ASC` > do > cat $i>>CDLIST > done Memory cleanup commands: ipcs -a |grep sid ipcrm -m (# next to m) ipcrm -s (# next to s) cleanipc 00 (system number) remove slibclean Exclude in grep: cat filename|grep -v text >> file.out --> -v will exclude the text Exclude multiple entries: df �k |grep �v data|grep �v �:� Using grep -v, tar every file under /usr/sap/put except data into nevalstarfile: for i in `ls /usr/sap/put|grep -v data' do tar -cvf /usr/sap/trans/tmp/nevalstarfile $i done Create a file with timestamp: cp -p neval neval`date +%Y%m%d` ls neval neval20050812 Find command options: find . -mtime +365 -exec ls -l {} \; --> Find files older than 365 days and lists them find . -name "lcd*" -mtime +5 -exec ls -l {} \; --> Finds files starting with lcd and older than 5 days. Vi Replace: :1,$ s/oldvalue/newvalue/g 1: First line $: all the way to the end s: substitute g: globber Netstat: netstat -rn --> shows the routing table route add -host IP address of the host -gateway IP address of the router at local (sapserv4's IP) (router's IP in the company) netstat �a|findstr 5555(port number) Printers: lpstat -pprintername for example lpstat -pNJ12 --> Shows the job queue lpstat -vprintername enable printername cancel jobnumber Check AIX APARs: instfix -ik IY63076 XTERM: Xterm �bg mistyrose �sb �sl 5000 �display @d&@ |