๐ ๏ธ Linux DevOps Toolbox: Elevate Your Productivity with Command-Line Magic ๐๐ก
Day-3 Task of 90 Days Of Devops

Experienced QA professional with a passion for manual and automation testing. Proficient in DevOps practices, ensuring seamless integration and continuous delivery. Dedicated to ensuring top-notch software quality and efficiency. Eager to contribute my skills to Hashnode's vibrant tech community. Let's collaborate and create exceptional experiences!
Linux is a powerful operating system with a wealth of commands to manage files and directories efficiently. In this blog, we will explore several fundamental Linux commands to perform various file operations. In this blog, we will explore several fundamental Linux commands to perform various file operations. Let's dive in! ๐
๐๏ธ๐To View the contents of a file
Cat - This Linux command allows you to view the contents of a file
Simply type
cat filename& PressEnterReplace "filename" with the name of the file you want to view.

๐๐Change access permissions of files
chmod -To modify the access permissions of a file, use the chmod command followed by the permission code and the file name.
The permission code consists of three digits representing read (4), write (2), and execute (1)permissions for the owner, group, and others, respectively.
Simply type
chmod 644 filename& PressEnterFor example - To give read and write permissions to the owner (4 for read + 2 for write = 6) and read-only permissions to the group (4) and others (also 4):
Here's a breakdown of the numeric representation as per the command
The first digit (6) represents the permissions for the owner (read + write). The second digit (4) represents the permissions for the group (read). The third digit (also 4) represents the permissions for others (read). Replace "filename" with the name of the file you want to modify. After running this command, the owner will have read and write permissions, while the group and others will have read-only permissions.

โฒ๏ธ๐Check your command history
history -To view the list of commands you have run in the terminal session history.
Simply type
history& PressEnterThis will display a numbered list of commands you executed during the current session.

๐๏ธ๐Remove a directory/folder
rm - To remove a directory/ Folder.
Simply type
rm filename/directoryname& PressEnter

๐๐Create a fruits.txt file and view its content
touch - To create an empty file named "fruits.txt,"
cat -To view the contents of the file (we discussed earlier)
Simply type
touch filename& PressEnterthen ,type
cat filename& PressEnter

๐๐Add content in fruits.txt (One in each line)
Vim - To open a file to add content
Simply type
vim filenamePressEnterInserting Text: To start inserting or editing text within the file, press
ifor insert mode. You can then type or modify text as needed.Saving and Exiting: To save the changes and exit vim, press
Escto ensure you are in normal mode, and then type:wqorZZ (Shift + zz)PressEnter

๐๐๐๐To Show only the top three fruits from the file
head - To display the top lines of the file
Simply type
head -3 filenamePressEnteryou can also use the
headcommand with the-noption

๐ป๐ฅ๐๐To Show only the bottom three fruits from the file
tail -To display the last lines of the file,
Simply type
head -3 filenamePressEnteryou can also use the
tailcommand with the-noption

๐๐จ๐To create another file with content in Colors.txt (One in each line) and to view the content.
We already discussed this earlier
touch,vim&catcommand

๐๐๐จTo find the difference between fruits.txt and Colors.txt file
diff - To compare the contents of two files and find the differences
Simply type
diff filename1 filename2PressEnterThe
diffcommand will display the lines that are different between the two files, if any.

With these essential Linux commands, you can efficiently manage and manipulate files and directories in your system.๐๐๐
๐So, I hope you found this blog helpful!
๐คIf you have any questions or need further assistance, please let me know in the comments section below. I am here to support you on your learning journey.
โIf you found this information valuable, consider following me on Hashnode for more insightful blogs. Stay tuned for future articles filled with exciting content.
๐๐Happy learning!๐ค




