Hello, fellow tech adventurers! Today is Day 3 of our Linux command journey, and boy, are we diving into some juicy commands. Imagine you and I sitting in a tech-filled room, chatting about these essentials. Ready? Let’s go!
1. Peek into a File
Ever wanted to spy on what's inside a file? The cat
command is like our backstage pass. Want to see what's in a file called example.txt
?
cat example.txt
2. The Magic of Permissions
Now, let's talk magic spells for files – permissions. With the chmod
command, you can make files dance to your tunes. For example, granting the owner read and write permissions:
chmod u+rw filename
3. The Memory Lane of Commands
Curious about the commands you've unleashed on the terminal so far? The history
command is like a nostalgic trip down memory lane:
history
4. Bid Farewell to a Folder
Feeling a bit Marie Kondo and want to declutter? Say goodbye to a directory using the rmdir
or rm
command:
rmdir directory_name
or
rm -r directory_name
5. Fruits.txt Adventure
Picture this: We create a file named fruits.txt
and spill the beans on our favorite fruits.
echo -e "Apple\nMango\nBanana\nCherry\nKiwi\nOrange\nGuava" > fruits.txt
cat fruits.txt
6. DevOps.txt Chronicle
For our DevOps journey, let's add some juicy content to devops.txt
. One fruit per line, because why not?
echo -e "Apple\nMango\nBanana\nCherry\nKiwi\nOrange\nGuava" > devops.txt
7. The Top Three Fruits
Want only the crème de la crème from fruits.txt
? The head
command’s got you covered:
head -n 3 fruits.txt
8. The Bottom Three Fruits
But wait, what about the underdogs? The tail
command unveils the bottom three from fruits.txt
:
tail -n 3 fruits.txt
9. Colors.txt Voyage
Let’s paint our tech canvas with a file named Colors.txt
. Ready to see the colors unfold?
echo -e "Red\nPink\nWhite\nBlack\nBlue\nOrange\nPurple\nGrey" > Colors.txt
cat Colors.txt
10. Spot the Differences
Want to play spot-the-difference between fruits.txt
and Colors.txt
? The diff
command is your game master:
diff fruits.txt Colors.txt
Signing Off
Voila! Day 3 – conquered. These commands are like our tech brushes, painting vibrant pictures in the Linux canvas. Stay tuned for more tech tales and command-line capers!
Happy coding! 🚀🔍