Basic Linux Commands

Basic Linux Commands

Linux command to:

  1. To view what's written in a file
cat file.txt
  1. To change the access permissions of files
chmod
  1. To check which commands you have run till now

  2.  history
    
    1. To remove a directory/ Folder
  •   rmdir
    
    1. To create a fruits.txt file and to view the content.
  •   cat > fruits.txt
           to exit press ctrl+d
    
  1. Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.

  2.  cat > fruit.txt
     Apple
     Mango
     Banana
     Cherry
     Kiwi
     Orange
     Guava
         to exit press ctrl+d
    

    7. To Show only the top three fruits from the file

  3.  head -3 fruits.txt
    

    8. To Show only the bottom three fruits from the file

  4.  tail -3 fruits.txt
    
    1. To create another file Colors.txt and to view the content

    2.  cat > Colors.txt
      

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

    3.  cat > Colors.txt
       Red
       Pink
       White
       Black
       Blue
       Orange 
       Purple
       Grey
            to exit press ctrl+d
      
      1. To find the difference between the fruits.txt and Colors.txt file
    4.  diff fruits.txt Colors.txt
      
  1. Thanks for watching my blog

  2. I hope you like it