Basic Linux Commands

Basic Linux Commands

This is Day 3 of 90 days of DevOps. Below are some new commands I have learned recently and have been practicing them. One must "not" remember every command out there, but should understand the capability of Linux and know what can be done.

To view what's written in a file

cat command can be used to view the content of the file.

To change the access permissions of files

chmod command allows you to change the permissions.

To check which commands you have run till now

history command is used to view the previously executed commands.

To remove a directory/folder

rm -r command is used to remove a directory or folder (r = recursively)

To create a file [fruits.txt], add 5 fruits, and view its content

touch command can be used to create a file. In this scenario, I used the "vim" command to create a file and added its context in the VIM Editor.

To show only the top 3 fruits from the file

head command will list out the first part of the list in the file. When head -3 command is used, it will list out the top 3 items in the file. tail command will list out the last part of the list. When tail -3 command is used, it will list out the bottom 3 items of the file.

To find differences between 2 files [class1.txt & class2.txt]

diff command can be used to display outputs in several formats. I have used the "normal format" below to run the diff command. You can use the below table as a reference to better understand the differences.

SymbolsDescription
Aadd
Cchange
Ddelete
#line numbers
--separating the files in the output
<1st file
\>2nd file


I appreciate your busy time reading this short blog. As I continue with my journey to learn and acquire the skill set of a DevOps Engineer, I will share what I learn. Thank you.

Happy Learning!


Sam Samarullah

LinkedIn

Previous Blog

Instagram