Introduction:
Welcome back to Day 3 of our #90daysdevops journey! Today, we're diving deeper into the Linux command-line interface, unraveling essential commands that are fundamental to mastering DevOps practices. Let's embark on this hands-on exploration of Basic Linux Commands.
Task 1: To view what's written in a file.
To view what's written in a file, we use the cat
command. It displays the contents of a file on the terminal. For example:
cat <file_name>
Task 2: To change the access permissions of files.
To change the access permissions of files, we use the chmod
command. It allows us to modify the permissions for the owner, group, and others. For example:
chmod permissions <file_name>
Task 3: To check which commands you have run till now.
To check which commands you have run till now, you can use the history
command. It displays a list of the most recent commands executed in the current session.
history
Task 4: To remove a directory/ Folder.
To remove a directory or folder, we use the rm
command with the -r
option to delete directories recursively. For example:
rm -r <directory_name>
Task 5: To create a fruits.txt file and to view the content. Task 6: Add content in fruits.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava.
To create a file, you can use the touch
command.
To add content to a file, you can use a text editor like nano
or vim
.
To view the content of a file, use the cat
command as shown earlier.
Task 7: To Show only top three fruits from the file.
To show only the top three fruits from the file, you can use the head
command with the -n
option to specify the number of lines to display. For example:
head -n 3 <file_name>
Task 8: To Show only bottom three fruits from the file.
Similar to Task 7, you can use the tail
command with the -n
option to show the bottom three fruits from the file.
tail -n 3 <file_name>
Task 9: To create another file Colors.txt and to view the content. Task 10: Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey.
Repeat the process of creating ,adding and viewing the content of the Colors.txt file as done for the fruits.txt file.
Task 11: Find Difference Between Files
To find the difference between two files, you can use the diff
command. For example:
diff <file1_name> <file2_name>
Conclusion:
Day 3 has been an immersive journey into Basic Linux Commands, equipping us with essential skills for effective DevOps practices. As we continue our exploration, let's leverage these commands to streamline our operations and empower our DevOps journey! Stay tuned for more insights and discoveries ahead. ๐๐ง #DevOps #LinuxCommands #LearningJourney