DEV Community

Dan Higgins
Dan Higgins

Posted on

5

Day 3: Create, Read, Delete — Your First File Kung Fu in RHEL 9

Welcome back, terminal traveler! You’ve figured out where you are in the Linux file system, and now it’s time to do something exciting:

Create stuff. Break stuff. Clean it up like nothing ever happened.

Today, we’re diving into the beginner-friendly basics of file manipulation — because knowing how to read, write, and obliterate files is essential in your Linux journey (and just feels kinda powerful).

Let’s get into it.

📚 Table of Contents

touch: The File Summoner

Want to create a file out of thin air like a command-line wizard?

Image description

Boom. You’ve just summoned an empty file named pizza.txt. It won’t have any pineapple on it (thankfully!), but it exists.

You can even create multiple files at once:

Image description

Linux: Now serving your entire meal in .txt format.

cat: The Instant File Reader

Let’s say you want to peek inside a file and see what it says. Maybe it holds deep secrets. Maybe it’s just a shopping list.

If there’s content, it’ll show it. If it’s empty, Linux just shrugs silently. No drama.

Want to create and write something into a file at the same time? Try:

Image description

Now type your ingredients. Then hit Ctrl + D to save and escape.

Now try cat pizza.txt again. Yum.

rm: The File Eliminator

Ready to delete something with the cold efficiency of a digital assassin?

Image description

Gone. No recycle bin. Just poof.

Warning: rm is forever. Like, actual forever. So use it wisely.

Want to delete multiple files?

Image description

Your entire menu is now digital dust.

Bonus Round: mkdir and rmdir, The Folder Wizards

Create a folder (directory). Now you’ve got a cozy new place to store your files.

Remove it (but only if it’s empty):

Image description

If it’s not empty, Linux will scold you. ("Clean your room first!")

Try This at Home (Your Linux Mini Quest)

  • Create a directory called practice
  • Move into it
  • Create three text files
  • Add a line of text to each using cat >
  • Read them using cat
  • Delete them one by one using rm
  • Delete the practice directory with rmdir

Image description

Boom! You just did real Linux file operations. You are the command line now.

Why This Matters

These aren’t just “beginner commands.” These are everyday tools used by real Linux pros.

They’re the building blocks of everything — scripting, configuration, automation, debugging... it all starts with knowing how to read, write, and delete files safely and confidently.

Up Next (Day 4): We’ll explore file permissions — or as I call it, “Who gets to touch my stuff?”

Stay tuned — and until then, keep poking around your terminal. The best way to learn Linux is by doing stuff, breaking stuff, and (hopefully) learning before you wipe out your whole /home folder

AWS Security LIVE! Stream

Streaming live from AWS re:Inforce

What’s next in cybersecurity? Find out live from re:Inforce on Security LIVE!

Learn More

Top comments (3)

Collapse
 
nevodavid profile image
Nevo David

Love this - stuff like deleting files always felt scary, but it's actually kinda fun once you get used to it.

Collapse
 
ldwit profile image
LaTerral Williams

echo “add pineapple” >> pizza.txt

Collapse
 
higgs182092 profile image
Dan Higgins • Edited

rm -r "LaTerral"

DevCycle image

Ship Faster, Stay Flexible.

DevCycle is the first feature flag platform with OpenFeature built-in to every open source SDK, designed to help developers ship faster while avoiding vendor-lock in.

Start shipping