5. One Line Scripts
Finding out the memory information on a HP Unix system
Total Memory :
——————-
echo “selclass qualifier memory;info;wait;infolog”|cstm | grep “Total Configured Memory”
All Memory Information , slots, modules etc.
———————————————
echo “selclass qualifier memory;info;wait;infolog”|cstm
List highest diskspace users in /home directory
sort -nr sorts the output in numerical reverse order giving highest at the top .
du -k /home | sort -nr | pg
*Find and list the core files in /app01 directory . Replace directory name(/app01 ) , file name (core) and command (ls -l ) to customize .
Print option prints the output . 2>/dev/null is to supress the error messages in the output .
find /app01 -name core -print -exec ls -l {} ; 2>/dev/null
Removing core files :
find /app01 -name core -print -exec rm -f {} ; 2>/dev/nul
compressing Log files
find /logdir -name *.log -print -exec gzip {} ; 2>/dev/null
List the partitions using more than 70% of disk partition space .
$5 represants column number to be compared and 70 is the value to be compared .
df -k | awk ‘$5 > 70’