Joining the #90DaysOfDevOps challenge ๐ under the guidance of Shubham Londhe Sir, alongside the #TrainWithShubham community! ๐โจ
Day 3 TASK :
๐งLinux commands:
To view what's written in a file:
Command:
cat
Syntax:
cat rhythm.txt
Explanation: This command displays the full contents of the specified file directly in the terminal window. To view the contents of a file, you can use the
cat
command2. To change the access permissions of files:
Command:
chmod
Syntax:
chmod [options] permissions filename
Explanation: Modifies the read, write, and execute permissions for a file or directory. The
chmod
command is used to change the access permissions of files.3. To check which commands you have run till now:
Command:
history
Syntax:
history
Explanation: Lists a chronological record of the commands executed in the current terminal session. To check the commands you have run so far, the
history
command is your go-to tool4. To remove a directory/Folder:
Command:
rmdir
Syntax:
rmdir directory_name
orrm -rf directory_name
Explanation: Deletes an empty directory. To remove a directory with its contents, use
rmdir directory_name
orrm -rf directory_name
(use with caution!). Thermdir
orrm
command can be used to remove a directory. Be cautious withrm
as it can delete files and directories permanently.5. To create a fruits.txt file and to view the content:
Commands:
touch fruits.txt
(creates the file)cat fruits.txt
(views the content)Explanation: To create a new file, you can use the
touch
command.To view the content, you can use thecat
command
6. Add content in fruits.txt (One in each line) - Apple, Mango, Banana, Cherry, Kiwi, Orange, Guava:
Command:
echo -e "Apple\nMango\nBanana\nCherry\nKiwi\nOrange\nGuava" > fruits.txt
7. To Show only the top three fruits from the file:
Command:
head devops.txt -n 3
8. To Show only the bottom three fruits from the file:
Command:
tail devops.txt -n 2
9. To create another file Colors.txt and to view the content:
Commands:
touch Colors.txt
(creates the file)cat Colors.txt
(views the content)
10. Add content in Colors.txt (One in each line) - Red, Pink, White, Black, Blue, Orange, Purple, Grey:
Command:
echo -e "Red\nPink\nWhite\nBlack\nBlue\nOrange\nPurple\nGrey" > Colors.txt
11. To find the difference between fruits.txt and Colors.txt file:
Command:
diff fruits.txt Colors.txt
Explanation:
This command compares the contents of
fruits.txt
withColors.txt
.It outputs the differences between the files in a line-by-line format.
Happy Learning :) ๐๐
Thank you for taking the time to read this blog. I hope you found valuable insights! If you enjoyed the content, please consider giving it a like, sharing it, and following for more insightful posts in the future. Your support means a lot! Looking forward to sharing more knowledge with you! ๐
๐A special thanks to Shubham Londhe #TrainWithShubham and the DevOps community for organizing this fantastic initiative. Let's learn, grow, and make a difference through DevOps!
Let's Connect..!
๐LinkedIn
๐Twitter
๐GitHub
:)Happy Learning...
Thank you for reading! ๐