Skip to main content

Command Palette

Search for a command to run...

Day-3: Basic Linux Commands 🐧

Updated
β€’2 min readβ€’View as Markdown
Day-3: Basic Linux Commands 🐧
J

Welcome to the DevOps world with Jay. who is a practitioner of the exciting domain. it's keeping up with the latest updates in the DevOps ecosystem or staying tuned to industry best practices, I'm embracing the mindset of continuous learning to stay relevant in this fast-paced environment.

Day 3 TASK

  • Linux Command to view what's written in file.

$ cat file.txt
#content of file will show here.
  • Linux command to change the access permissions of files.

$ chmod 777 filename
  • Linux command to check which commands you have run till now.

$ history 
#all previous commans will show here.
  • Linux command to remove a directory/ folder.

$ rm filename
#remove file.
$ rmdir directoryname
#remove directory.
  • Linux Command to create a fruits.txt file and view the content.

$ touch fruits.txt
#create empty file filename frutis.txt
$ cat fruits.txt
# view the content but not showing anything because its empty file
  • Linux command to add content in devops.txt (one in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.

#this will open the file and write content then save 
 $vi fruits.txt
#another option is like below to add direct content into file when we creating a file
$ echo -e "Apple\nMango\nBanana\nOrange\nkiwi" > fruits.txt
# now cat command show you all content
  • Linux Command to show only top three fruits from the file.

$ head -n 3 fruits.txt
# OR
$ cat fruits.txt | head -3
  • Linux Command to show only bottom three fruits from the file.

$ tail -n 3 fruits.txt
# OR
$ cat fruits.txt | tail -3
  • Linux Command to create file colors.txt and to view the content.

#same as above (fruits.txt)
$ touch colors.txt
$ cat colors.txt
  • Linux Command to add content in colors.txt (one in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.

#same as above (fruits.txt)
$ echo -e "Red\nPink\nWhite\nblue\nOrange\npurple" > colors.txt
  • Linux Command to difference between fruits.txt and colors.txt file.

 $diff fruits.txt colors.txt

_Wow! You are at the end, if it is helpful please do follow βž• and like to support.πŸ’š

_Thank you for reading. πŸ“–

_Jay

More from this blog

jaychavda

5 posts

Hello, I am Jay Chavda. As a Devops Engineer, I'm excited about the endless possibilities and the chance to contribute to the intersection of development and operations.