Skip to main content

Command Palette

Search for a command to run...

Day 3 Task: Basic Linux Commands

Day - 3 : 90 Days of DevOps

Published
2 min read
Day 3 Task: Basic Linux Commands

Task: What is the linux command to:

  • To view what's written in a file.
$ cat [filename]

  • To change the access permissions of files.
$ chmod

  • To check which commands you have run till now.

      $ history
    
  • To remove a directory/ Folder.

$ rm -r [folder name] ; remove the non-empty directory.
$ rm -d [folder name] ; remove the empty directory.

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

      $ touch fruits.txt ; create file
      $ cat frutis.txt ; view the content
    
  • Add content in fruits.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.

  •   $ vim fruits.txt
    
  • To Show only top three fruits from the file.

$ head -n 3 fruits.txt

  • To Show only bottom three fruits from the file.
$ tail -n 3 fruits.txt

  • To create another file Colors.txt and to view the content.
$ touch colors.txt
$ cat colors.txt

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

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

      $ diff fruits.txt colors.txt
    

More from this blog

Untitled Publication

8 posts