Day 3 : DevOps ❤️

Let's Discuss some more questions on Linux

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

     cat file_name
    
  2. To change the access permissions of files.

     chmod permission_code file_name
    

    permission_code :

    1. Read: 4

    2. Write: 2

    3. Execute: 1

\=> Users:Groups: Others

For Ex: chmod 700 file.sh

The above command means that users have all the 3 permissions (i.e. read, write, execute) on the other hand groups, and others have no permissions.

  1. To check which commands you have run till now

     history
    
  2. To remove a directory/ Folder

     rm -r folder_name
    

    -r = recursively (used if the folder is not empty)

  3. To create a fruits.txt file and to view the content.

     vim fruits.txt
     cat fruits.txt
    
  4. Add content in devops.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava

     echo "Apple" > devops.txt 
     echo "Mango" >> devops.txt 
     echo "Banana" >> devops.txt 
     echo "Cherry" >> devops.txt 
     echo "Kiwi" >> devops.txt 
     echo "Orange" >> devops.txt 
     echo "Guava" >> devops.txt
    
  5. To Show only the top three fruits from the file

     head -n 3 devops.txt
    
  6. To Show only the bottom three fruits from the file

     tail -n 4 devops.txt
    
  7. To create another file Colors.txt and to view the content.

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

    echo "Red" > Colors.txt
    echo "Pink" >> Colors.txt 
    echo "White" >> Colors.txt
    echo "Black" >> Colors.txt
    echo "Blue" >> Colors.txt
    echo "Orange" >> Colors.txt
    echo "Purple" >> Colors.txt
    echo "Grey" >> Colors.txt
    
  9. To find the difference between the fruits.txt and Colors.txt file

    diff fruits.txt Colors.txt
    

    Bye GIFs - Get the best gif on GIFER