Module 2 · Linux you will actually use · Lesson 8 of 16

Find your way and search logs fast

The folders that matter on every test, and how grep, pipes and redirection turn a long log into one answer.

In this lesson · about 20 minutes

  • Name the Linux folders a tester checks first
  • Search a log with grep and count with uniq -c
  • Chain small tools with a pipe and save output with redirection

Not a tour of every command. This module teaches the handful of Linux skills that come up in every engagement: finding your way around, reading logs fast, understanding permissions (which is how most privilege escalation works), and automating a boring job with a script.

Where things live

Linux keeps everything in one tree that starts at /. These folders come up on almost every test, on your own Kali box and on targets:

PathWhat is thereWhy a tester cares
/home/kaliYour files (~ for short)Keep one folder per engagement here.
/etcSystem settings/etc/passwd, /etc/shadow, service configs with passwords in them.
/var/logLogsEvidence of logins and attacks, yours included.
/tmpScratch space anyone can writeA common place for attackers to drop tools.
/usr/share/wordlistsKali's password and directory listsUsed for web and password testing. rockyou.txt.gz lives here.
/optExtra softwareWhere you put tools that are not Kali packages.

Move with cd, check where you are with pwd, and list with ls -la. The -a shows hidden files whose names start with a dot, which is where SSH keys and shell history hide.

Whiteboard · watch and try

A pipeline, step by step

Press Play. Watch a 2,140-line log become one answer.

5 steps
Press Play and the tutor will talk you through it while writing on the board. Pause any time to write on the board yourself.

Tip: press Pause, then use the pen to work along on the board. Space plays and pauses; Ctrl+Z undoes your last mark.

Here is the whole pipeline on one line. Read it left to right: keep failed logins, print the 11th word (the source IP), sort them, count duplicates, then put the biggest count first.

grep "Failed password" auth.log | awk '{print $11}' | sort | uniq -c | sort -rn

Check your understanding0 of 2 correct

Question 1

1.What does the pipe | do?

Question 2

2.Which ls option shows hidden files such as .ssh?

Quiz score: 0 of 2

Tip: answer every quiz question correctly first.

For authorized, lab-based learning only. Tana Roasters and every person, address and password in this course are fictional. Every terminal is simulated. "Kali Linux" is a trademark of OffSec; this course is not affiliated with or endorsed by OffSec.