Basic Linux commands #Day3

Table of contents

No heading

No headings in the article.

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

    To view the contents of a file in Linux, you can use the cat command. The cat command stands for "concatenate" and is used to display the contents of one or more files to the standard output.

    Example :- cat shubham.txt

  2. To change the access permissions of files.

    To change the access permissions of files in Linux, you can use the chmod command. The chmod command stands for "change mode" and is used to modify the read, write, and execute permissions of a file or directory.

    Example :- chmod +777 shubham.txt

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

    history command will help you to see all the commands, which is run by you.

  4. To remove a directory/ Folder.

    "rmdir" command will help you to delete the directory but if there is any file present inside the directory then please use "rm -r directory_name".

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

    "vi fruits.txt" will help you to create the file.

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

    "head -n 3 fruits.txt" will help you see the top 3 fruits' names.

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

    "tail -n 3 fruits.txt" will help you see the top 3 fruits' names.