Get Cyfirx free

Linux evidence cheat sheet

Where the evidence is on Linux servers and desktops, grouped by the question you are trying to answer. Paths are for Debian and Ubuntu, with Fedora and RHEL where they differ. Free, no sign-up, and it prints on a few pages. ~ is the user's home folder.

Before you collect

On a live system, collect what disappears first, then image the disk.

WhatWhereNote
Processes and connectionsps auxf, ss -tupan, lsof -nPLost at shutdown.
Programs whose file was deletedls -l /proc/*/exe 2>/dev/null | grep deletedA running program with its file removed is a classic sign of an intruder. Copy it from /proc/<pid>/exe.
MemoryLiME or AVMLCapture RAM before shutting down, if you need it.
Logs kept only in memory/run/log/journal/If the journal is not persistent, it is gone after a reboot.

About the system

WhatWhereNote
Distribution and version/etc/os-release
Host name/etc/hostname, /etc/hosts
Time zone/etc/localtime, /etc/timezone; timedatectlWrite it down first. The journal stores UTC; text logs often use local time.
Install date/var/log/installer/ (Debian, Ubuntu), /root/anaconda-ks.cfg (Fedora, RHEL)
Networks/etc/NetworkManager/system-connections/, /etc/netplan/, /etc/network/interfacesWi-Fi names and settings; files can hold Wi-Fi passwords.
Addresses handed out/var/lib/NetworkManager/*.lease, /var/lib/dhcp/DHCP leases with times.
Disks and mounts/etc/fstab, lsblk -f

Who logged on, and how?

WhatWhereNote
Accounts/etc/passwd, /etc/shadow, /etc/groupAny account with UID 0 besides root is a red flag. In shadow, field 3 is the last password change (days since 1970).
Who may be root/etc/sudoers, /etc/sudoers.d/; the sudo or wheel group
Login history/var/log/wtmp (last -f), /var/log/btmp (lastb, failed)Newer systems may use /var/lib/wtmpdb/wtmp.db (wtmpdb last).
Last login per user/var/log/lastlog (lastlog)Newer systems: /var/lib/lastlog/lastlog2.db (lastlog2).
Logged in now/var/run/utmp (who, w)
Authentication log/var/log/auth.log (Debian, Ubuntu), /var/log/secure (Fedora, RHEL)SSH logins, sudo, su, failed passwords. Many new installs keep these only in the journal.
From the journaljournalctl _COMM=sshd, journalctl _COMM=sudoThe same events where there is no auth.log.
SSH keys~/.ssh/authorized_keys, ~/.ssh/known_hosts, /etc/ssh/sshd_configKeys that may log in; machines this user connected to (often hashed).

What commands and programs were run?

ArtifactWhereWhat it tells you
Shell history~/.bash_history, ~/.zsh_history, ~/.local/share/fish/fish_history, /root/.bash_historyWritten when the shell exits, and easy to turn off: a missing or empty file is itself evidence.
Other histories~/.viminfo, ~/.lesshst, ~/.python_history, ~/.mysql_historyFiles edited, searched and queried.
Audit log/var/log/audit/audit.log (ausearch, aureport)Only if auditd is running; then very detailed.
Process accounting/var/log/account/pacct (Debian), /var/account/pacct (RHEL); lastcommOnly if turned on.
Packages installed/var/log/dpkg.log, /var/log/apt/history.log; /var/log/dnf.log, dnf history; /var/log/pacman.logWhat was installed or removed, when, and by which command.
Changed system filesdpkg --verify, rpm -VaFiles that differ from what the package installed.
Snap and Flatpaksnap changes, flatpak history

What starts by itself? (persistence)

ArtifactWhereNote
cron/etc/crontab, /etc/cron.d/, /etc/cron.{hourly,daily,weekly,monthly}/, /var/spool/cron/crontabs/ (Debian), /var/spool/cron/ (RHEL)User crontabs are in the spool folder.
at jobs/var/spool/cron/atjobs/ (Debian), /var/spool/at/ (RHEL)
systemd services and timers/etc/systemd/system/, ~/.config/systemd/user/; systemctl list-timers --allUnits from packages are in /usr/lib/systemd/system/; new ones in /etc deserve a look.
Shell start-up~/.bashrc, ~/.profile, ~/.bash_profile, /etc/profile, /etc/profile.d/, /etc/bash.bashrc
Older start-up/etc/rc.local, /etc/init.d/
Desktop autostart~/.config/autostart/, /etc/xdg/autostart/
Library preloading/etc/ld.so.preloadUsually missing or empty. Anything here is a rootkit sign.
Kernel modules/etc/modules, /etc/modules-load.d/; lsmod
Login rules/etc/pam.d/A changed PAM file can let anyone in.
Device rules/etc/udev/rules.d/Can run a program when a device is plugged in.

Which USB devices were connected?

ArtifactWhereWhat it tells you
Kernel messagesjournalctl -k, /var/log/kern.log, /var/log/syslog, /var/log/messages"New USB device found" with idVendor, idProduct and SerialNumber, and the disk name it got.
Mountedjournalctl -u udisks2; folders under /media/<user>/, /run/media/<user>/Volume names and when they were mounted.
Right nowlsusb, /sys/bus/usb/devices/Only devices connected at the moment.

Which files were opened, and what was deleted?

ArtifactWhereWhat it tells you
Recent files (GNOME and others)~/.local/share/recently-used.xbelFiles opened, by which app, with times.
Recent files (KDE)~/.local/share/RecentDocuments/
Thumbnails~/.cache/thumbnails/Each PNG stores the original file's path and time, even after the file is deleted.
Trash~/.local/share/Trash/files/, ~/.local/share/Trash/info/*.trashinfoThe .trashinfo file gives the original path and deletion date.
Staging places/tmp, /var/tmp, /dev/shmWhere intruders often drop tools; /dev/shm lives in memory.
Backups of key files/var/backups/ (Debian), editor swap files (.*.swp)Older copies of passwd, shadow and group; text being edited.
SnapshotsBtrfs (btrfs subvolume list /), LVM (lvs), ZFS, TimeshiftOlder copies of whole file systems.
A word on deletionOn ext4 and SSDs with TRIM, deleted file contents are hard to recover. Look for copies instead.

What was browsed or downloaded?

BrowserWhereNote
Firefox~/.mozilla/firefox/<profile>/places.sqliteSnap: ~/snap/firefox/common/.mozilla/firefox/.
Chrome~/.config/google-chrome/<profile>/HistoryProfile is Default or Profile 1, 2...
Chromium~/.config/chromium/<profile>/HistorySnap: ~/snap/chromium/common/chromium/.
Brave~/.config/BraveSoftware/Brave-Browser/<profile>/History
Flatpak apps~/.var/app/<app id>/Each Flatpak browser keeps its profile here.

Logs worth knowing

WhatWhereNote
systemd journal/var/log/journal/ (kept), /run/log/journal/ (lost on reboot)Read a copied journal with journalctl -D <folder>.
System log/var/log/syslog (Debian, Ubuntu), /var/log/messages (Fedora, RHEL)Debian 12 and later have no syslog file unless rsyslog is installed.
Boots and shutdownsjournalctl --list-boots, last -x
Web servers/var/log/apache2/, /var/log/httpd/, /var/log/nginx/Access logs show every request: look for odd paths and uploads.
Containers/var/lib/docker/, /var/lib/containers/, ~/.local/share/containers/Images, containers and their logs (Docker, Podman).
Tamperingjournalctl --verifyGaps in time, empty files and a failed verify mean logs may have been cleared.

Memory on disk

WhatWhereNote
Swapswap partition or /swapfile (see /proc/swaps)Pieces of memory: strings, commands, keys.
Hibernationthe swap space named in the kernel resume= optionOnly if the machine hibernated.
Core dumps/var/lib/systemd/coredump/; coredumpctl listPrograms that crashed, with their memory.

Before you start

Work on an image or a verified copy, never the original. Hash what you collect and write down who handled it: our free evidence hash checker and chain of custody form does both in your browser. Note the time zone and the clock offset before reading any time.

The other cheat sheets: Windows, macOS.

Get Cyfirx free   What Cyfirx does

Paths differ between distributions, versions and settings, and many logs are off or short-lived by default. Always confirm an artifact on a test system before relying on it. This sheet is a reference, not legal advice. © Cyfirx.