Day 3 of Linux Mastery : Deep Dive into Core Linux Commands
Table of Contents Introduction Real-World Practical Tasks Scenario I Faced and Solution Conclusion Let's Connect Introduction Welcome to Day 3 of my 30 Days of Linux Mastery series. If this is your first read, I am currently working toward my RHCSA + RHCE, and every day, I document what I learn, not just to study, but to make this useful for anyone trying to break into DevOps, platform engineering, or cloud infrastructure. In my previous day 2 article, I explained the core Linux commands used everyday, click here to read day 2. However, I did not give you more ways to use these commands like a pro. Let's dive into more ways to use these Linux commands more effectively with real-world examples! Here are the commands we will focus on; mkdir touch cat rm cp mv. Real-World Practical Tasks Let's assume you just got hired as a Cloud Engineer. You have been assigned the task below. Let's tackle it. Set up a full directory structure for a cloud migration simulation, create multiple placeholder files, manage them efficiently, and clean up obsolete folders, but make sure you don't delete anything you shouldn't. That last part says “Don’t delete anything you shouldn’t”. Well, it turned into a whole rabbit hole but I will walk you through it all. Let us go step by step. mkdir command Let's explore more ways to create multiple folders at one go using the mkdir Create multiple folders using sequence. mkdir bash mkdir Cloudproject # creates one directory mkdir /Cloudproject/aws{1..5} # creates multiple folders inside Cloudproject mkdir -p /Cloudproject/aws/s3/ec2 #creates nested or sub folders inside the Cloudproject. # The -p flag means parent tells Linux: “If the parent folders don’t exist, make them too.” touch command Just like mkdir we can create multiple files using touch using the sequence method. bash touch /Cloudproject/aws/bucketv{1..6}.txt # this creates bucketv1.txt, bucketv2.txt, up till bucketv6.txt cat : View or Add Content to Files Now we can create, write or just view what's inside our files using this command. bash cat > bucketv2.txt # To write inside a the bucketv2.txt file cat bucketv2.txt # To read or view the bucketv2.txt cat >> bucketv2.txt # To append or add new text to the file cp command This is just for copying files and folders. This is very essential for creating backups before deployments. We will see how to use Wildcards as well. bash cp bucketv2.txt bucketv3.txt. #This copies the file over to bucketv3.txt bash cp -rvf /Cloudproject/aws/bucketv{1..3}.txt /Cloudproject/aws/s3/ # This copies multiple files from the source to the destination The -rvf copies this at once forcefully and informs you of it. bash # another way to use cp is with WILDCARD * cp -rvf /rvf /Cloudproject/aws/bucketv* /Clouproject/aws1 #This wildcard is used to copy similar items at once into another folder. mv command This is used to move/cut and paste files or folders, and also for renaming. Just like the cp command, we can do same for the mv command. Let's say we create a file s3.mp3 and want to move it to aws folder rm command This is for deleting or removing files or folders. We have; r: recursive (for folders) v: verbose (show what it's doing) f: force (don’t ask questions and most dangerous) Let's remove all matching bucketv* bash [root@localhost aws]# rm -rvf bucketv* This removes all matching words with the bucket and deletes them permanently Scenario I Faced and Solution I encountered a challenge while using the rm -rvf. I created a folder. Cloudproject. Added multiple folders in it. aws{1..5} Added another multiple files .txt in it. Eg aws{1..5}.txt I decided to remove all folders named aws with the wildcard Applied rm - rvf aws* Output: It deleted both the folders and the txt files because the command deletes both folders and files. Solution To avoid this, I used this command. bash find /Cloudproject/ -type d -name 'aws*' -exec rm -rvf {} + # This deletes only directories or folders. # To delete only files use -type f. Breakdown find is precise: It will only match what you tell it to: folders, files, extensions. . : search current directory -type d : match only directories -name 'aws*' : match names starting with aws -exec rm -rvf {} + — for each result, run rm -rvf Conclusion Real Linux work isn’t just typing commands; it is thinking through what you are doing, so you don’t wipe out your whole project accidentally. This day was full of small but critical wins, especially learning how to selectively delete. Let's Connect! If you want to connect or share your journey, feel free to reach out on LinkedIn. I am always happy to learn and build with others in the tech space. #30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linu

Table of Contents
- Introduction
- Real-World Practical Tasks
- Scenario I Faced and Solution
- Conclusion
- Let's Connect
Introduction
Welcome to Day 3 of my 30 Days of Linux Mastery series. If this is your first read, I am currently working toward my RHCSA + RHCE, and every day, I document what I learn, not just to study, but to make this useful for anyone trying to break into DevOps, platform engineering, or cloud infrastructure.
In my previous day 2 article, I explained the core Linux commands used everyday, click here to read day 2. However, I did not give you more ways to use these commands like a pro.
Let's dive into more ways to use these Linux commands more effectively with real-world examples! Here are the commands we will focus on; mkdir
touch
cat
rm
cp
mv
.
Real-World Practical Tasks
Let's assume you just got hired as a Cloud Engineer. You have been assigned the task below. Let's tackle it.
Set up a full directory structure for a cloud migration simulation, create multiple placeholder files, manage them efficiently, and clean up obsolete folders, but make sure you don't delete anything you shouldn't.
That last part says “Don’t delete anything you shouldn’t”. Well, it turned into a whole rabbit hole but I will walk you through it all.
Let us go step by step.
mkdir
command
Let's explore more ways to create multiple folders at one go using the mkdir
- Create multiple folders using sequence.
mkdir
bash
mkdir Cloudproject # creates one directory
mkdir /Cloudproject/aws{1..5} # creates multiple folders inside Cloudproject
mkdir -p /Cloudproject/aws/s3/ec2 #creates nested or sub folders inside the Cloudproject.
# The -p flag means parent tells Linux: “If the parent folders don’t exist, make them too.”
touch
command
Just like mkdir
we can create multiple files using touch
using the sequence method.
bash
touch /Cloudproject/aws/bucketv{1..6}.txt # this creates bucketv1.txt, bucketv2.txt, up till bucketv6.txt
cat
: View or Add Content to Files
Now we can create, write or just view what's inside our files using this command.
bash
cat > bucketv2.txt # To write inside a the bucketv2.txt file
cat bucketv2.txt # To read or view the bucketv2.txt
cat >> bucketv2.txt # To append or add new text to the file
cp
command
This is just for copying files and folders. This is very essential for creating backups before deployments. We will see how to use Wildcards as well.
bash
cp bucketv2.txt bucketv3.txt. #This copies the file over to bucketv3.txt
bash
cp -rvf /Cloudproject/aws/bucketv{1..3}.txt /Cloudproject/aws/s3/
# This copies multiple files from the source to the destination
The -rvf copies this at once forcefully and informs you of it.
bash
# another way to use cp is with WILDCARD *
cp -rvf /rvf /Cloudproject/aws/bucketv* /Clouproject/aws1
#This wildcard is used to copy similar items at once into another folder.
mv
command
This is used to move/cut and paste files or folders, and also for renaming.
Just like the cp
command, we can do same for the mv
command.
- Let's say we create a file s3.mp3 and want to move it to aws folder
rm
command
This is for deleting or removing files or folders. We have;
- r: recursive (for folders)
- v: verbose (show what it's doing)
f: force (don’t ask questions and most dangerous)
Let's remove all matching bucketv*
bash
[root@localhost aws]# rm -rvf bucketv*
This removes all matching words with the bucket and deletes them permanently
Scenario I Faced and Solution
I encountered a challenge while using the rm -rvf.
- I created a folder. Cloudproject.
- Added multiple folders in it. aws{1..5}
- Added another multiple files .txt in it. Eg aws{1..5}.txt
- I decided to remove all folders named aws with the wildcard
- Applied rm - rvf aws*
Output:
It deleted both the folders and the txt files because the command deletes both folders and files.
Solution
To avoid this, I used this command.
bash
find /Cloudproject/ -type d -name 'aws*' -exec rm -rvf {} +
# This deletes only directories or folders.
# To delete only files use -type f.
Breakdown
-
find
is precise: It will only match what you tell it to: folders, files, extensions. - . : search current directory
-type d : match only directories
-name 'aws*' : match names starting with aws
-exec rm -rvf {} + — for each result, run rm -rvf
Conclusion
Real Linux work isn’t just typing commands; it is thinking through what you are doing, so you don’t wipe out your whole project accidentally. This day was full of small but critical wins, especially learning how to selectively delete.
Let's Connect!
If you want to connect or share your journey, feel free to reach out on LinkedIn.
I am always happy to learn and build with others in the tech space.
#30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linux #Rhel #Ansible #Vim #CloudComputing #DevOps #LinuxAutomation #IaC #SysAdmin#CloudEngineer