DEV Community

Cover image for ⚔️ Day 26 Linux Challenge: grep, find, head, tail & wc Edition
Rajpreet Gill
Rajpreet Gill

Posted on

2 1 1

⚔️ Day 26 Linux Challenge: grep, find, head, tail & wc Edition

Welcome back to Day 26 of my #100DaysOfLinux challenge!
Today, you're not just reading — you're playing along 🎮.

We’re diving deep into essential Linux CLI tools:

  • grep
  • find
  • head / tail
  • wc

Ready? Let’s go 💪

📚 Table of Contents


🔧 Step 1: Create Your Sample File

Before we jump into the challenges, let’s create a simple file with mixed log lines:

Image description

This file (file.txt) will be our playground today.Then check with cat file.txt.

Image description

🎯 The Tools & Commands You’ll Use

Before the challenge, here's your weapon list:

Command Purpose
grep Pattern matching (search inside files)
find Locate files and folders
head Show beginning of files
tail Show end of files
wc Count words, lines, bytes

🚨 Challenge 1: grep Games

🎯 Task:

  1. Find all lines that start with "ERROR".
  2. Find lines that end with "completed".
  3. Ignore case and search for "warning".
  4. Show lines that do not contain "INFO".
  5. Count how many times "404" appears.

💡 Hints:

Image description


🕵️‍♀️ Challenge 2: Find It Like a Pro

🎯 Task:

  1. Find all .log files in /var/log.
  2. Find all .sh files modified in the last 2 days.
  3. Find all empty .txt files.

💡 Hints:

Image description


📜 Challenge 3: Head & Tail of the Story

🎯 Task:

  1. Show the first 5 lines of a file.
  2. Show the last 15 lines.
  3. Watch a log file update live.

💡 Hints:

Image description

Image description


🧪 Challenge 4: Count Me In (wc)

🎯 Task:

  1. Count number of lines in a file.
  2. Count total words.
  3. Get line + word + byte count together.

💡 Hints:

Image description


🤖 Bonus Challenge: Find the Unmatched Lines

🎯 Task:

You have two config files: config.old and config.new.
Find which lines are in config.old but not in config.new.

💡 Hint:

grep -v -F -x -f config.new config.old


🏆 Your Turn!

Pick any 3 challenges above and try them out in your terminal.

Then come back and drop a comment:

  • ✅ Which one did you complete?
  • 🚤 Which one was hard?
  • 🚀 Which one was fun?

#30DaysLinuxChallenge #CloudWhisler
DevOps #Linux #RHCSA #Opensource #AWS #CloudComputing

Catch out by My LinkedIn profile
https://www.linkedin.com/in/rajpreet-gill-4569b4161/

Top comments (0)