Pages

23 October 2010

Important Basic Linux Command

Before posting on any other advance server topic, I think , must post some basic commands of linux. Because most people hunting for this comman every time. here we are going to write most usable basic command.

Command    -----   Syntax    ---------   Purpose

1.  ls  ---- ls   ---   List files & directories

2.  ls -l  ----  ls -l   ----   List files & directories with extra information e.g. permission, ownership, size & modification date

3.  ls -ltr  ----   ls -ltr  ------   This command shows all information as "ls -l" but alway show last created or modified file/dir at bottom

4.  cd   ----  cd  -----  Move to users' root directory from any where
       
                  cd ..     -----   Move to the parent directory of the current directory.For example if you are in /home/user/dir, then this comman move                             you in /home/user
       
                 cd /etc   -----  Change the current working directory to /etc or you can enter into directory using this command.
   
5.  mkdir  ----  mkdir mydirectory   ----   Create "mydirectory" ( you can replce mydirectory with any name you want for directory you are creating)

6.  touch  ----   touch file01   ----    Creates a blank file if not exist or update if exist.

7.  cat  ----  cat file01  ----     Shows contents of file01
       
                  cat  > file02  ----   Create file named file02       
   
                  cat >> file02  ----  Can append contents of file02

                        ( to save data with cat press CTRL+D or CTRL+C for cancle)

8.  less  ----   less /etc/passwd   -----  For navigate file contents or standard input

9.  head  ----  head /etc/passwd  ----   Show top 10 lines of file

10. tail  ----  tail /etc/passwd  ----  Show bottom 10 lines of file

11. pwd  ---- pwd  ----- Show current working directory

12. cp  --- cp file01 /tmp  ----   Create duplicate of file01 to /tmp

13.  mv  ----   mv file01 file02   ---- Rename file01 into file02
       
                     mv file01 /tmp  ----    Move file01 into /tmp