Saturday, February 20, 2010

Useful tips in AIX

USEFUL TIPS IN AIX

AIX USEFUL TIPS



ls -l /home | sort -rn        This displays files and directoris inside /home as per their size, larger file on top.

ls -l /home/* sort -rn        This displays files and also the subdirectories in the /home/ directories as per their size, larger one on top.

Note:  If /home dir. contains more than one dir. then it first shows all the directiory name and then the files inside the directories as per the directory order. The order is symlink, Directory name, file name.

du /home | sort -rn          This also displays the subdirectories inside /home as per their size but not files.

du -m /home/test/smit.log     This shows the size of the smit.log in MB. 
-g=GB, -k=KB, without flag=shows in Block size.


ls -lrt | grep 'Jan 10' | awk '{print$9}' > namefile          This is used to get only the file names dated Jan 2010 in a namefile

rm `cat namefile`           To delete filenames mentioned in the namefile created by the above command.


To execute a command in a loop, i.e. in a certain intervals, put the small script in the shell

while i=
do
df -g /backup
sleep 3
done

in the above example this will show the size of /backup filesystem in each 3 seconds interval.


stty erase ^?       To use backspace button to clear previous letters.

set -o vi      To see previous executed commands using vi style
i.e. esc+ j=up, h=down, l=go right, g=go left, /string= search the command from history,












**********