Skip to main content

Command Palette

Search for a command to run...

##Day 3 Task: Basic Linux Commands

Published
•2 min read•View as Markdown
##Day 3 Task: Basic Linux Commands

Task: What is the Linux command to

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

    command:cat <file name.txt>

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

    command:history

  3. To remove a directory/ Folder.

    command:rmdir <folder name>

  4. To Remove a file

    command:rm <file name>

    mast

  5. To create a fruits.txt file

    command:touch fruits.txt

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

    command: vim fruits.txt

    1. Type i to switch into insert mode so that you can start editing the file. And to exit from 'insert' mode, hit ESC (the escape key).

    2. Type command:wq to save and exit your file.

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

    command: head -3 fruits.txt

    This command prints the first N number of data of the given input. By default, it prints 7 lines.

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

    command: tail -e fruits.txt

    This command prints the last N number of data of the given input. By default, it prints 7 lines.

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

    command: touch colors.txt

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

    command: vim colors.txt

    1. Type i to switch into insert mode so that you can start editing the file. And to exit from 'insert' mode, hit ESC (the escape key).

    2. Type command:wq to save and exit your file.

  11. To find the difference between fruits.txt and colors.txt files.

    command: diff fruits.txt colors.txt

More from this blog

Aman's blog

25 posts