Basic Bash commands for LINUX.



  • man  - format and display the on-line manual pages

              man  <commandName>
              ex: man grep, man cal
           

  • mkdir - make directories
              mkdir  <directoryName>
              ex: mkdir xyz


  • cd  - change directory
             cd  <directoryName>
             ex: cd xyz      

  • ls   - list directory contents
              ls  -[option] <diraname>
              ex: ls home


  • touch  - creates a file
              touch <fileName>
              ex: touch file.txt , touch file.eps touch file


  • vi -(editor) opens a file and if it doesn't exist, creates a file
              vi  <fileName>
              ex: vi file.txt , vi file.c , vi file.tcl , vi file.sh


  • gedit - (editor) (same as vi)


  • cp - copy file and directory
               cp -[options] <source> <destination>
               ex: cp file1 file2, 


  • rm - remove files or directories
               rm [option] <fileName>
               ex: rm file1.txt 


  • cut  - remove sections from each line of files
              cut [option] <fileName>
              ex: cut -c2 file.txt                //remove second character from file file.txt

  • paste  - merge lines of files
             paste [option] <fileName>
            ex: paste file1                      //without options works like "cat" command
                  paste -s file 1                   //join all lines in file1



  • cat - concatenate files and print on the standard output


              cat [option] <fileName>
              ex: cat  file.txt  , cat file1.txt file2.txt              

  • su - run a shell with substitute user and group IDs
             su [option] [user]
             ex: su root , su  - <username>


  • sudo , sudoedit - execute a command as another user
              //reboot your system in 20 minutes
              sudo shutdown -r +20  "rebooting to fix network issue" 


  • time - time a simple command or give resource usage
                time [options] command [arguments]
                ex: /usr/bin/time ls 


  • date  - print or set the system date and time
            date [option] [+format]
            date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
           ex: date , date  +%T


  • cal - displays a calendar

           cal [-smjy13] [[month] year]
           ex: cal , cal -3 ,cal -yy

  • pwd - print name of current/working directory
           pwd [option]
          ex: pwd

  • chpasswrd - update passwords in batch mode
         chpasswd [options]  
         ex: chpasswd
  • grep
  • sed
  • tail
  • head
  • free
  • top
  • ps
  • locate
  • find
  • sort
  • pipe '|'
  • kill
  • bkill
  • shutdown
  • poweroff
  • exit
  • USER
  • chmod
  • chown
  • links
  • ln
  • wget
  • email
  • mount/unmount
  • gunzip/gzip
  • tar
  • route
  • netstate
  • alias/unalias
  • lastlog
  • service
  • iconfig
  • display
  • usermod
  • make
  • arp
  • ping
  • watch
  • basename
  • dirname
  • at
  • dos2unix
  • du
  • timeconfig
  • script
  • tac
  • more
  • dmsg
  • convert

Post a Comment

Previous Post Next Post