Linux Commands Hands On

Linux Commands Hands On

To view what's written in a file.

Cat: This is used to concatenate and display files on the terminal.

To change the access permissions of files.

Chmod: This command is used to change the access permissions of files and directories.

To check which commands you have run till now.

history: It shows the list of commands you have run till now.

To remove a directory/ Folder

rm: it is used to remove a directory/file

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

touch: is used to create file

vim: is used to open the editor

Vim Options:

Press 'i' -> to insert anything

Press "Esc" -> to return to normal mode

Press ":wq" -> save and quit

cat: to see the content of the file

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

We can use vim/cat to add content to a file.

To show only the top three fruits from the file.

head -n 3: to see the top 3 content.

To show only the bottom three fruits from the file.

trail: to see bottoms content

To create another file Colors.txt, add the content - Red, Pink, White, Black, Blue, Orange, Purple, and Grey. And, view the content.

To find the difference between Devops.txt and Colors.txt files.

diff: to find the difference between two files

Thank you for reading this Blog. Hope you learned something new today! If you found this blog helpful, please share it with others.