Some common Linux commands

Some common Linux commands

Mostly used commands in daily work

  1. To view what's written in a file :

  1. To change the access permissions of files :

     chmod 777 <filename> rwx
    

  2. To check which commands you have run till now :

     history #list all the previous cmd
    

  3. To remove a directory/ Folder :

     rm <filename> #fist enter in the directory then delete file
    

  4. To create a fruits.txt file and view the content :

     touch fruits.txt #to create the file
     cat fruits.txt  #view the content
    

  5. Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava :

     touch devops.txt
     vim devops.txt #press i then write one by one list fruit name in each line then :Wq to save and exit
     cat devops.txt #show all list what's written inside it
    

  6. To Show only top three fruits from the file :

     head -n 3 devops.txt
    

  7. To Show only bottom three fruits from the file :

     tail -n 3 devops.txt
    

  8. To create another file Colors.txt and to view the content :

     touch colour.txt
    
  9. Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey :

          echo "Red" >> colour.txt
          echo "Pink" >> colour.txt
          echo "White" >> colour.txt
          echo "Black" >> colour.txt
          echo "Blue" >> colour.txt
          echo "Orange" >> colour.txt
          echo "Purple" >> colour.txt
          echo "Gray" >> colour.txt
    
    1. To find the difference between fruits.txt and Colors.txt file :

       diff fruits.txt colour.txt
      

These are some basic commands which used in daily basis hope you liked it, Follow for more.