Day 3 Task: Basic Linux Commands

Day 3 Task: Basic Linux Commands

Task: What is the Linux command to

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

    To view the contents of a file in Linux, you can use the cat command.

    1.png

  2. To change the access permissions of files.

    To change the access permissions of files in Linux, you can use the chmod command.

    2.png

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

    To check the command history in Ubuntu, you can use the history command.

    3.png

  4. To remove a directory/ Folder.

    To remove a directory /folder in Ubuntu, you can use the rm command.

    4.png

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

    Use the touch command to create a new file called fruits.txt.

    5.png

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

    Use a text editor such as vim or vi to create a new file called fruits.txt and add the content to it.

    6.png

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

    To display only the top three fruits from the fruits.txt file that you created, you can use the head command in the terminal.

    7.png

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

    To display only the bottom three fruits from the fruits.txt file you can use the tail command in the terminal.

    8.png

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

    Use the touch command to create a new file.

    9.png

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

    To add the content into a file called Colors.txt with each color on its own line you can use a text editor or the command line

    10.png

  11. To find the difference between fruits.txt and Colors.txt file.

    To find the difference between the fruits.txt and Colors.txt files you can use the diff command in the terminal.

    11.png