Published January 29, 2011 by

Unix Miscellaneous commands

  1. ls
  2. pwd
  3. ln
  4. head
  5. tail
  6. cal
  7. ps
  8. kill
  9. who
  10. whoami
  11. uptime
  12. ut
ls : This command displays files and directories in columnar format.


$ ls

$ ls -S                

Aarrange the files based on the size(S is upper letter)

$ ls -l                

long listing the files

$ ls -a                

Displays hidden files

$ ls -i 

Displays inodes for each file

$ ls -R            

Displays all directories along with subdirectories in current working directory.

creating a hidden file:

$ cat >.employee.txt            

Wild card characters using with ls command.

 Represents single character
*   Represents gruop of characters
[  ]   Represents searching pattern


$ ls ?                Displays files with one letter

$ ls x*               Displays files which are starting with 'x'

$ ls ???           Displays files with 3 letters

$ ls *.out          Displays all the files with extension 'out'

$ ls [a-z]           Displays single character files which are from a to z

$ ls [a-z]*          Displays files starting with a to z

$ rm ?               Removes the files with single character

$ rm *.c             Removes the files with extension 'c'

$ cp ? chennai       Single digit files will be copied into directory 'chennai'

pwd : This command shows current working directory in unix

$ pwd

head :  Used to display First lines of the file


$ head -n  filename


$ head  paypal.txt

     This command dispalys default 10 lines of the file paypal.txt

$ head -n15  paypal.txt

    This command displays 15 lines of the file paypal.txt

$ head -n3  paypal.txt

    This command displays 3 lines of the file paypal.txt

tail : Used to display last lines of the file.


$ tail paypal.txt

      This command displays default last 9 lines.

$ tail -n5 paypal.txt

      This command displays last 4 lines of the file.

$ tail -n15 paypal.txt

       This command displays last 14 lines of the file.

cal command: Used for display the calender.


$ cal

$ cal  [Month No] [Year]


$ cal 2011                Displays 2011 calender

$ cal  2   2011          Displays Feb month in 2011 year

ln :

1.This will create link between 2 files.(2nd file should new one)

2. If one file modified another one affected.


$ln paypal.txt    funpal.txt

ps : Knowing backgroud process running /stopped

$ ps pid     

kill : Used for terminating the process


$ kill  pid

who : Used for to display who are working in the system


$ who

whoami: Display my user name/accout


$ whoami

uptime: This command used for display load in the server.

$ uptime

ut: displays current unix time

advance_date : Used to time forward the unix server.

$ advance_date : Used to reset time and date in unix server.


    email this