Basic Linux Commands part 2

Basic Linux Commands part 2

Table of contents

No heading

No headings in the article.

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

    To view what's written in a file we use the "cat" command. It will display all the content of a file.

  2. To change the access permissions of files.

    we can modify permissions using the "chmod" command.

     chmod permissions filename
    
  3. To check which commands you have run till now.

    The "history" command in Linuxis a built-in shell tool that displays a list of commands used in the terminal session.

  4. To remove a directory/ Folder.

    To remove an empty directory, use the "rmdir" command.

    To remove a directory and all its contents, including any subdirectories and files, use the "rm -r" command.

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

    To create a color.txt we use "touch" command and to view the content of the file we use "cat" command.

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

    To add content in the devops.txt file we use the "vim" command.

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

    "cat color.txt | head -3"

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

    "cat color.txt | tail -3"

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

    To add content in the devops.txt file we use the "vim" command.

  10. To find the difference between fruits.txt and Color.txt file.

    The "diff fruits.txt color.txt "is used to find the difference between the fruits.txt and Color.txt files.

Did you find this article valuable?

Support Arnav Singh by becoming a sponsor. Any amount is appreciated!