Intro to Linux
If you have not used Linux, getting started takes a little extra work — but there is plenty of help online and most things are easier than they look. Linux is free and open source, needs fewer resources than Windows, and can breathe life into an old PC.
Strictly speaking, "Linux" is just the kernel — the core that talks to your hardware. What you actually install is a distribution (a "distro"): the kernel plus a desktop, a package manager and a curated set of software, assembled by a community or company. That is why Ubuntu, Debian and Mint can all be "Linux" yet look and feel different.
For a digital investigator, Linux is not just a cheaper Windows. It changes how you can work with evidence:
Read-only by design
You can mount a disk image or evidence drive read-only, so the act of looking never alters the source. Preserving integrity is the whole game in forensics.
No hidden activity
No registry churn, no background telemetry rewriting timestamps. What runs, runs because you told it to — which keeps your analysis machine predictable.
Scriptable everything
Every tool is text-in, text-out and chainable. One line can carve, filter, sort and hash thousands of files. Repeatable steps mean defensible results.
The tools live here
The Sleuth Kit, Volatility, YARA, Wireshark, plaso and most open-source DFIR tooling are first-class citizens on Linux, often packaged and ready to install.
You can do forensics on any distro, but several are pre-built with the tooling already in place:
REMnux
A reverse-engineering and malware-analysis toolkit on Ubuntu. The go-to for examining a suspicious sample safely.malware analysis
SIFT Workstation
SANS' free incident-response and forensics distro — disk, memory and timeline tooling in one place.IR + forensics
Tsurugi Linux
A DFIR-oriented distro with a strong focus on acquisition and analysis, plus OSINT tooling.acquisition
Kali Linux
Best known for offensive security, but its forensics mode and packaged tools make it useful on the blue-team side too.broad toolkit
Packages
Linux ships many distributions differing in look and installed software (called packages). Package management differs per distro — RPM (Red Hat Package Manager) and DPKG (Debian) are the two main families. The course uses Debian-based Linux (Ubuntu, Linux Mint, Debian, REMnux).
A package is a bundle of software plus a description of everything it needs to run (its dependencies). A package manager installs that bundle, pulls in the dependencies automatically, and keeps track of what is on the system so you can update or remove it cleanly. No hunting for installers, no leftover files — this is one of the quiet pleasures of Linux.
| Family | Used by | Low-level tool | High-level tool |
|---|---|---|---|
| DPKG (Debian) | Debian, Ubuntu, Mint, REMnux | dpkg | apt |
| RPM (Red Hat) | Fedora, RHEL, CentOS, Rocky | rpm | dnf / yum |
On the Debian-based systems used here, apt is the command you will reach for daily. The typical workflow:
$ sudo apt update # refresh the list of available packages
$ sudo apt upgrade # install updates for what you already have
$ sudo apt install yara # install a package (and its dependencies)
$ apt search sleuthkit # find a package by keyword
$ apt show sleuthkit # read the description before installing
$ sudo apt remove yara # uninstall, keeping config files
$ sudo apt purge yara # uninstall and remove config tooupdate refreshes the catalogue; upgrade applies it.apt update before apt install or upgrade. Without it, you are installing from a stale catalogue and may pull an old version or fail to find a package at all.A starter set you will likely want on an analysis machine:
$ sudo apt install sleuthkit yara clamav-daemon \
wireshark tshark binwalk foremost exiftool \
net-tools curl jqThe terminal
The terminal — the Command Line Interface (CLI) — is where Linux shows its power, and for many it is a learning curve: new commands, flags and ways of working in a text box.
lablo@linuxserver:~$ sudo apt-get updateThat prompt tells you more than it looks. Read it left to right:
| Part | Meaning |
|---|---|
lablo | The user you are logged in as. |
linuxserver | The hostname of the machine. |
~ | Your current directory (~ is your home folder). |
$ | A normal user prompt. A # here means you are root — full power, full risk. |
Almost every command follows the same shape: the command, some options (flags), and one or more arguments.
$ ls -lah /var/log
│ │ └── argument (what to act on)
│ └─────── options (how to behave: long, all, human-readable)
└─────────── command (what to run)-lah is the same as -l -a -h.Linux protects system areas behind the root account. sudo ("superuser do") runs a single command with elevated rights — far safer than logging in as root permanently. If a command fails with Permission denied, that is usually the system telling you to think before you reach for sudo.
This is the idea that makes Linux a multitool. Every command produces text, and you can feed one command's output straight into the next. Small, single-purpose tools combine into something far larger than any one of them.
| Operator | Does | Example |
|---|---|---|
| | Pipe — send output of one command into the next | cat auth.log | grep Failed |
> | Redirect output to a file (overwrites) | ... > results.txt |
>> | Append output to a file | ... >> results.txt |
2> | Redirect errors separately | find / ... 2>/dev/null |
$ cat access.log | grep "POST" | awk '{print $1}' | sort | uniq -c | sort -rnThe filesystem
Unlike Windows' drive letters, Linux has a single tree starting at / (the root). Knowing where things live is half of any investigation — logs, configs and running-process data all have a home.
| Path | What lives there — and why you care |
|---|---|
/etc | System and service configuration. Persistence and tampering often show up here. |
/var/log | Logs. Your first stop in almost every investigation — auth, syslog, web server, etc. |
/home | User data and dotfiles. Shell history, SSH keys, downloads. |
/tmp | Temporary files. A common staging ground for dropped payloads. |
/proc | A live view of running processes and the kernel — not real files on disk. |
/bin /usr/bin | Executables. Compare against a known-good baseline to spot trojanised binaries. |
/root | The root user's home directory. |
Navigation is quick once the verbs are muscle memory:
$ pwd # where am I?
$ ls -lah # list everything, with detail and sizes
$ cd /var/log # change directory
$ cd .. # up one level
$ cd ~ # back to homeCore commands for DFIR
A small set of commands covers most investigative needs. Learn these and you can read logs, find files, follow processes and verify evidence — the everyday motions of an examiner.
| Command | Use |
|---|---|
cat file | Dump a whole file to the screen. Fine for small files. |
less file | Page through a large file without loading it all. / searches, q quits. |
head -n 50 file | First 50 lines. |
tail -n 50 file | Last 50 lines. |
tail -f file | Follow a log live as new lines arrive — invaluable while reproducing an event. |
find walks the filesystem and filters on almost any property — name, age, size, permissions. It is the workhorse for locating artifacts in a mounted image.
$ find / -name "*.php" -mtime -1 2>/dev/null
$ find /tmp -perm -4000 -type f # SUID files — classic privesc check
$ find /home -name "id_rsa" 2>/dev/null # SSH private keys left behind
$ find / -newermt "2026-06-23" -type f 2>/dev/null2>/dev/null hides the "permission denied" noise.$ ps aux --sort=-%cpu # all processes, hungriest first
$ ss -tulpn # listening ports + owning process
$ lsof -p 1337 # files and sockets a process has open
$ ss -tn state established # active connections right nowLog analysis with text tools
Logs are just text, and Linux is exceptional at text. Four small tools — grep, awk, cut, sort/uniq — answer most "who, what, how many" questions you will ask of a log.
| Tool | One-line role |
|---|---|
grep | Find lines matching a pattern. The single most important text tool — see the full cheatsheet. |
awk | Treat each line as columns; print, compute or filter by field. |
cut | Slice out fixed columns by delimiter — lighter than awk for simple jobs. |
sort / uniq | Order lines and collapse or count duplicates. |
wc -l | Count lines — how many hits, how many events. |
# Top 10 IPs hitting a web server
$ awk '{print $1}' access.log | sort | uniq -c | sort -rn | head
# Failed SSH logins, with the offending IP
$ grep "Failed password" /var/log/auth.log | awk '{print $11}' | sort | uniq -c | sort -rn
# How many 404s today
$ grep " 404 " access.log | wc -l
# Pull the 4th column (a field) from a colon-delimited file
$ cut -d: -f4 /etc/passwd| stage. You learn far more by watching the data narrow at each step than by typing the whole line at once.Artifact triage
When you have an unknown file — a suspicious download, a carved fragment, a sample from an alert — a few commands tell you what it is and let you record it defensibly before you do anything else.
| Command | Answers |
|---|---|
file sample.bin | What type is this, really? Identifies by content (magic bytes), not by the extension someone gave it. |
stat sample.bin | Modify / access / change timestamps and permissions — the MAC times that anchor a timeline. |
strings -n 8 sample.bin | Printable text inside a binary — URLs, IPs, commands, ransom notes. Often the fastest first clue. |
sha256sum sample.bin | A cryptographic hash to record the file and look it up against VirusTotal or a known-bad list. |
xxd sample.bin | head | A hex + ASCII view of the first bytes — read the magic header directly. |
$ file invoice.pdf.exe
invoice.pdf.exe: PE32 executable (GUI) Intel 80386, for MS Windows
$ strings -n 8 invoice.pdf.exe | grep -iE "http|\.exe|cmd|powershell"
$ sha256sum invoice.pdf.exe
$ stat invoice.pdf.exefile reports as a Windows executable is the whole story. strings piped into grep then surfaces the indicators worth chasing.file and strings are passive, but the moment you risk execution, containment matters.Hashing is not only for malware — it is how you prove a copy is identical to the source. Hash before and after any handling and the values must match.
$ sha256sum evidence.img > evidence.img.sha256 # record at acquisition
$ sha256sum -c evidence.img.sha256 # verify later: OK or FAILEDWhere to go next
This page is a foundation. Two companion references go deeper.
grep — the full cheatsheet
Regex basics, every useful flag, and DFIR-focused examples: hunting IOCs, extracting IPs and emails, searching across a mounted image.Open grep cheatsheet →
Linux commands cheatsheet
A searchable reference of the commands used across the Defencia infrastructure — services, networking, firewall, Docker and DFIR triage.Open command reference →