Unix Tech Tips

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′

Pages: 1 2 3 4 5 6

Tags:

2 Responses to “Unix Tech Tips”

  1. Andrew Hardej Says:

    This will also do it.

    tr -d ‘15′ new_file_name

  2. Andrew Hardej Says:

    My prior post has the wrong syntax. See below:

    Removing ^M from UNIX text files

    tr -d ‘15′ new_file_name

Leave a Reply

Comments will be published after approval by Moderator.