DEV Community

Dan Higgins
Dan Higgins

Posted on

2

Day 6 – “Where Did It Go?!” | Mastering the find, head, tail, and wc Commands in RHEL 9

Let me paint you a picture.

You're sitting at your terminal. You know you downloaded that important file somewhere. Maybe in Downloads. Or Documents. Or... was it in the mysterious /tmp?

You try clicking around, but there’s no clicky. Just blinking text. Panic sets in.

But wait — you have a superpower now. It’s called the command line, and today, we’re wielding four little heroes who will help you find what’s missing, peek inside files, and count like a digital mathematician.

📚 Table of Contents

Meet the Squad

find: The Detective

find is like the Sherlock Holmes of the Linux terminal. You give it a clue — a filename, a directory, maybe a wildcard — and it scours your system like a caffeine-powered bloodhound.

Image description

That says: “Dear Linux, go search everywhere inside /home for a file called notes.txt.” It's fast, it’s sharp, and it doesn’t stop until it gets results.

Bonus: It’s also great for hunting down lost dignity after a failed rm command.

head: The Chiller

You know when you only want to read the first few pages of a book to see if it’s worth your time? That’s what head does for files.

Image description

It gently shows you the top 10 lines of the file without forcing you to scroll for days. Classy, right?

Need more or fewer lines?

Image description

Just 2 lines. Enough to understand the shopping list.

tail: The Gossip

tail is the nosy neighbour who only cares about what’s happening at the end. Perfect for checking logs or watching new info appear in real time.

Image description

Even better:

Image description

That -f means “follow” — as in, “I’ll sit here and live-stream this log file like it’s my Netflix.”

wc: The Bean Counter

wc stands for word count, but it's secretly a stats machine. It can tell you how many lines, words, and characters are in a file.

Image description

Need just the line count?

Image description

This is perfect for flexing: “I wrote 894 lines of config today.” Boom. Productivity.

Try This: Your Mini Linux Mission

  1. Create a test file
  2. Use head to view the first 3 lines
  3. Use tail to check the last 2 lines
  4. Use wc -l to count how many lines total
  5. Misplace it and use find to save the day

Image description

Why This Stuff Matters

Each of these commands does a simple job — but together, they make you a smarter, faster Linux user.

Think of them like the tools in Batman’s utility belt. Alone? Useful. Together? Unstoppable.

And remember: reading tutorials is great — but typing the commands, messing around, and breaking stuff a little is how you really learn. File-fu takes practice.

So go explore, poke around, count some words, and tail some logs. Your terminal superpowers are growing by the day.

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)