Thursday, September 17, 2009

 

Unix Commands & Tricks

/usr/ucb/ps auxww -> This command will give detailed info about the processess

fgrep -V "regexp" -> Will list all the lines that DONT have this reg exp

head -50 -> prints the first 50 lines in a file ( same for tail )

Ctrl-r -> to auto complete a previously entered command

cd - -> to swap btw current and previously visited dir

! --> replay from history short cut

df -kh --> readable view of the Disk Space ( in GB - human readable )

du -skh . --> size of the current dir (in GB - human readable )

prtconf|grep Mem --> for finding the RAM size of the machine (Solaris)

isainfo -v --> To find out if your OS is 32 or 64 bit (Solaris)

ls -1 --> to list files one per line with no other details ( its one not l )

time [app/cmd] --> used to measure the time taken by the prog/cmd executed

pkill -9 java --> kills all java processes ( can be used to kill processes based on type )

ptree/pstree --> displays process and threads in a tree (solaris/linux)

ggrep -r "18025" `find . -name '*.pid'` --> grep for a expression in all files matching the pattern recursively

comm -23 file-1.txt file-2.txt --> print lines only in file-1 but not in file-2 ( refer to man comm for details )

hostname --> changes the hostname for good, if used without args prints hostname.

find . -name "*[0-9]" | awk '{ print "rm " $1}' | sh --> delete all files using regex ( in this case all file names ending with a number )

prtdiag - Best command to find the type of Processors/cores used in a unix system

iotop - Find which processes are Top users of IO in Unix

iostat - Lets you know the % of use of Reads/Writes of disk IO in a system

Labels: , , , , ,


Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?