Day 3 - Basic Linux commands

Day 3 - Basic Linux commands

Task: What is the linux command to

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

    $ cat <filename.txt>

  2. To change the access permissions of files.

    $ sudo chmod g+rwx <filename>

  3. To check which commands you have run till now.

    $ history

  4. To remove a directory/ Folder.

    $ rm -rf <foldername>

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

    $ vim fruits.txt

    # creates a fruits.txt file and takes you to the editor, press i to enter into edit mode and write the content. Save it by esc and :wq! enter

    $ cat fruits.txt

  6. # prints the content from fruits.txt

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

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

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

    $ vim devops.txt

    $ cat devops.txt

    $ head -n 3 devops.txt

    $ tail -n 3 devops.txt

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

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

    $ vim colours.txt

    $ cat colours.txt

  12. To find the difference between fruits.txt and Colours.txt file.

    $ diff fruits.txt colours.txt

Reference: https://www.linkedin.com/pulse/linux-commands-devops-used-day-to-day-activit-chetan-/