0Pricing
Ethical Hacking Academy · Lesson

Essential Commands

grep, find, awk.

Essential Commands is a free Ethical Hacking Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Ethical Hacking Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

The Power of the Shell

A handful of text-processing commands let you slice, search, and transform data at speed. For a hacker this means filtering scan output, parsing logs, and finding secrets quickly.

This lesson covers grep, find, and awk, plus the glue between them.

grep Basics

grep searches text for lines matching a pattern. It is your first tool for finding interesting strings in files or output.

grep 'password' config.php
grep -i 'admin' users.txt   # case-insensitive

grep Recursively

Search entire directory trees with -r. Combine with -n to show line numbers and -l to list only matching files.

grep -rn 'API_KEY' /var/www/
grep -rl 'BEGIN PRIVATE KEY' /home/

grep with Regex

grep -E enables extended regular expressions for flexible matching - useful for pulling IPs, emails, or tokens from messy output.

grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' scan.txt

find by Name

find walks the filesystem looking for files matching criteria. The most common is searching by name.

find / -name '*.conf' 2>/dev/null
find /home -iname 'id_rsa'

find by Attributes

find can match by type, size, permissions, and modification time - powerful for enumeration during privilege escalation.

find / -perm -4000 -type f 2>/dev/null   # SUID files
find /var -mtime -1                       # changed in last day

find with -exec

The -exec action runs a command on each match. The {} is replaced by the filename.

find . -name '*.log' -exec grep -l 'failed' {} \;

awk Basics

awk processes text column by column. By default it splits each line on whitespace into fields $1, $2, and so on.

awk '{print $1}' access.log      # first column
awk '{print $1, $9}' access.log  # two columns

awk Field Separator

Use -F to set a custom delimiter. This makes awk perfect for parsing files like /etc/passwd which use colons.

awk -F: '{print $1}' /etc/passwd     # usernames
awk -F: '$3 >= 1000 {print $1}' /etc/passwd  # normal users

Pipes and Chaining

The pipe | sends one command's output into the next. Chaining grep, awk, sort, and uniq builds powerful one-liners.

cat access.log | awk '{print $1}' | sort | uniq -c | sort -rn

Other Handy Tools

Round out your toolkit:

  • cut - extract columns by delimiter.
  • sort / uniq - order and dedupe.
  • wc -l - count lines.
  • sed - stream editing and substitution.
cut -d: -f1 /etc/passwd
sed 's/foo/bar/g' file.txt

Quick Check

Match the tool to the task.

Recap

You learned the core text-processing trio:

  • grep finds matching lines (-r, -i, -E).
  • find locates files by name, permission, time, with -exec.
  • awk parses columns with custom field separators.
  • Pipes chain them into powerful one-liners.

Next: managing users and processes.

Frequently asked questions

Is the “Essential Commands” lesson free?

Yes — the full text of “Essential Commands” is free to read here on the web, and the Ethical Hacking Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Ethical Hacking Academy course, upgrade to CoddyKit PRO.

What will I learn in “Essential Commands”?

grep, find, awk. You practise Ethical Hacking Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Ethical Hacking Academy?

No prior experience is required. Ethical Hacking Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Essential Commands” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Ethical Hacking Academy lesson?

Yes. Every Ethical Hacking Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. The Linux File System
  2. Essential Commands
  3. User and Process Management
  4. Networking Commands
← Back to Ethical Hacking Academy