Tuesday, May 28, 2013

Unix Commands


Although I have been using linux for more than 5 years now, I still feel googling for linux command  as fun. And as great people have said, all fun comes to an end, here is my first step in putting this to an end. I am compiling some commonly used linux commands which one should master. I have tried to explain some of them in depth

Reference :
http://www.thegeekstuff.com/2010/11/50-linux-commands/
http://community.linuxmint.com/tutorial/view/778


  1. tar [options] : commonly used options are
    1. x : extract file from archive
    2. c : create a new archive
    3. f : use archive file
    4. t : list the content of an archive
    5. v : verbose
    • Example : 
    • tar xvf   archive.tar  (to extract archive.tar)
    • tar cvf  archive.tar file1 file2 (to create archive.tar from files 1 and 2 )
    • tar tvf  archive.tar (to list content of archive.war)   
  2. grep [options] pattern [filename] : to search strings in a file. if no filename is specified it will search in standard in put. options can be following
    1. -i  : ignore case both for patern and filename
    2. -r : recursively in the folder
    3. -A 3 : also prints 3 more lines are the line matching the pattern
    • Example
    • grep -i "paroksh" winners.txt
    • grep -r "paroksh" myFolder
  3. ps [options]: to see process running. (options are letters which can be grouped together).They are invoked using - options. They can take following values
    1. -e : select all processes
    2. -f : format
    • Example:
    • ps -ef  : to list all processes in formated way
    • ps -ef | grep tomcat  (it feeds result of ps to pipe which is in put to find pattern tomcat)

to be continued ...