Linux basic commands (Part - 2)

Linux basic commands (Part - 2)

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

    • cat command will list out the file contents, once you execute cat with the filename you want to read.
  1. To change the access permissions of files/folders.

    • To change the access permissions of files/folders.

      In the below example we are giving read, write and execute permission.

      777 denotes: read, write and execute permission for users, groups and others.

      Each permission has a numeric value assigned to it:

  • r (read): 4

  • w (write): 2

  • x (execute): 1

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

    • history command is used to view the previously executed command.
  2. To remove a directory/folder.

    • To remove a directory and all its contents, including any subdirectories and files, use the rm command with the recursive option, -r

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

    Vim is a text editor, after running vim fruits.txt, press i to insert text in the file.

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

  2. To show only the top three fruits from the file.

  3. To show only the bottom three fruits from the file.

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

To find the difference between the 2 texts file.