Linux commands

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

     bashCopy codecat filename
    
  2. To change the access permissions of files:

     bashCopy codechmod permissions filename
    
  3. To check which commands you have run till now:

     bashCopy codehistory
    
  4. To remove a directory/Folder:

     bashCopy coderm -r directoryname
    
  5. To create a fruits.txt file and view the content:

     bashCopy codetouch fruits.txt
     cat fruits.txt
    
  6. To add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava:

     swiftCopy codeecho -e "Apple\nMango\nBanana\nCherry\nKiwi\nOrange\nGuava" > devops.txt
    
  7. To show only the top three fruits from the file:

     bashCopy codehead -n 3 devops.txt
    
  8. To show only the bottom three fruits from the file:

     bashCopy codetail -n 3 devops.txt
    
  9. To create another file Colors.txt and view the content:

     bashCopy codetouch Colors.txt
     cat Colors.txt
    
  10. To add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey:

    swiftCopy codeecho -e "Red\nPink\nWhite\nBlack\nBlue\nOrange\nPurple\nGrey" > Colors.txt
    
  11. To find the difference between fruits.txt and Colors.txt file:

    Copy codediff fruits.txt Colors.txt