Basic Linux Commands (Linux in Daily Routine)

AWS Devops | Linux | Docker | Jenkins | Terraform | Kubernetes | Ansible |
In this article, we'll explore fundamental Linux commands frequently used in everyday tasks involving Linux as the operating system.
๐ To view what's written in a file:
"cat" command is used to view the file

๐ To change the access permissions of files:
"chmod" command is used for changing file permission

๐ To check which commands you have run till now:
"history" command is used to view all the previous commands.

๐๏ธ To remove a directory/Folder
"rm -r" command means to remove recursively

๐ To create a fruits.txt file and view the content:
"touch" command to create a file and "cat" command to view a file

To add content in devops.txt (One in each line) - ๐Apple, ๐ฅญMango, ๐Banana, ๐ Cherry, ๐ฅ Kiwi, ๐ Orange, ๐ Guava
"echo -e 'text' > filename" '-e' is used to enable the '\n' interpretation and '\>' is redirection to a particular file to save the output

๐ผ To Show only the top three fruits from the file:
"head -n" to show the desired number of lines in a file.

๐ฝ To Show only the bottom three fruits from the file:
"tail -n" to show the desired number of lines in a file.

To create another file ๐จcolors.txt and view the content:
"touch" command to create a file and "cat" command to view a file

To add content in ๐จcolors.txt (One in each line) - ๐ด Red, ๐ Pink, โช White, โซ Black, ๐ต Blue, ๐ Orange, ๐ฃ Purple, ๐ซ๏ธ Grey:
"echo -e 'text' > filename" '-e' is used to enable the '\n' interpretation and '\>' is redirection to a particular file to save the output

To find the ๐ difference between fruits.txt & colors.txt file
"diff" command is used to show difference in file

1,5c1,5: This part of the output indicates that lines 1 to 5 in the first file have been changed to lines 1 to 5 in the second file. In other words, the lines from the first file are different from the lines in the second file.
The < symbol indicates the lines from the first file that are being changed.
The > symbol indicates the lines from the second file that replace the corresponding lines in the first file.
Let's interpret the changes based on the result:
Lines 1 to 5 in the first file (original file) contain the fruits "Apple," "Mango," "Banana," "Cherry," and "Kiwi."
Lines 1 to 5 in the second file (modified file) contain the colors "Red," "Pink," "White," "Black," and "Blue."
The first file originally had "Guava" on line 7, but it is not present in the second file.
The second file has added "Purple" and "Grey" on lines 7 and 8, respectively.




