Day 3: Essential Linux Commands for DevOps Beginners

Greetings, tech enthusiasts! 👋
As part of my #90DaysOfDevOps journey, I successfully completed Day 03, where I explored Basic Linux Commands. This hands-on task was a great way to dive deeper into Linux functionalities while honing my scripting and problem-solving skills.
In this blog, I'll walk you through my tasks, the steps involved, and the solutions, along with their respective outputs. By the end, you'll have a clear understanding of the commands I used, backed by real examples!
🛠️ Tasks Accomplished on Day 03
1. View the Content of a File and Display Line Numbers
Using the cat command with -n flag:
cat hello.txt -n
Output:

2. Change File Permissions for the Owner Only
The chmod command lets us change access permissions:
chmod 700 hello.txt
Output:

3. Check the Last 10 Commands Run
Using the history command:
history | tail -n 10
Output:

4. Remove a Directory and Its Contents
Using the rm command with -r flag:
rm -rf DevOps
Output:

5. Create and Display the Content of fruits.txt
Commands used:
vim fruits.txt
cat fruits.txt
Output:

6. Append "Pineapple" to fruits.txt
echo Pineapple >> fruits.txt
cat fruits.txt
Output:

7. Display the First Three Fruits in Reverse Order
Commands used:
cat fruits.txt | head -n 3 | tac
Output :

OR
head -n 3 fruits.txt | tac
Output:

8. Sort the Bottom Three Fruits Alphabetically
Commands used:
cat devops.txt | tail -n 3 | sort
Output:

OR
tail -n 3 devops.txt | sort
Output:

9. Create and Display the Content of Colors.txt
Commands used:
vim Colors.txt
cat Colors.txt
Output:

10. Prepend "Yellow" to Colors.txt
Commands used:
sed -i '1s/^/Yellow\n/' Colors.txt
cat Colors.txt
Output:

11. Display Common Lines Between fruits.txt and Colors.txt
Using the comm command:
comm -12 <(sort fruits.txt) <(sort Colors.txt)
Output:

12. Count Lines, Words, and Characters in Both Files
Using the wc command:
wc fruits.txt Colors.txt
Output:

🎉 Pull Request Made
I also made a pull request to the #90DaysOfDevOps repository with my solutions.
You can check it here:
👉 Pull Request Changes
🚀 Takeaway
Completing these tasks not only enhanced my understanding of Linux commands but also improved my ability to manage files and data effectively—a critical skill for any DevOps enthusiast!
Thank you for reading! If you have any feedback or want to share your experience, feel free to comment below or connect with me on GitHub or LinkedIn.
Until tomorrow, happy learning! ✨




