Linux Reconnaissance Commands

Built-in Linux commands for post-exploitation situational awareness — the Linux counterpart to windows-reconnaissance-commands. These require no external tools, work on virtually any Linux system, and map to MITRE ATT&CK Discovery techniques. They are also LOLBins — living-off-the-land binaries that blend in with normal administration.

System identity

CommandPurpose
cat /etc/issueOS distribution banner
cat /proc/versionKernel version and build info
hostnameSystem hostname
uname -aKernel, architecture, hostname, OS

Users and privileges

CommandPurpose
cat /etc/passwdAll local user accounts
idCurrent user’s UID, GID, and groups
wCurrently logged-in users and their processes
whoLogged-in users (with source IP for network sessions)
lastRecently logged-in users (with source IPs)
sudo -lCurrent user’s sudo permissions — see sudo

Processes and services

CommandPurpose
ps auxfwwFull process tree
ps auxwwDetailed process listing

Network

CommandPurpose
ifconfigNetwork interfaces and IPs
ip routeRouting table
netstat -anoAll listening ports and connections, no DNS resolution
netstat -iPer-interface statistics
netstat -lOnly listening ports
netstat -pProtocol and service info (root for full detail)
netstat -sProtocol statistics
lsof -iProcesses using network ports (pair with netstat)

Environment and history

CommandPurpose
envEnvironment variables (may contain credentials)
historyShell command history (may contain passwords, keys, IPs)

Installed packages

CommandPurpose
dpkg -lInstalled packages (Debian-based)
rpm -qaInstalled packages (Red Hat-based) — see rpm-file-package-matching

Files and capabilities

CommandPurpose
findSearch for files (SUID, config, credentials)
getcapList executables with POSIX capabilities
lsDirectory listing

Sources

Defense perspective

These commands are ubiquitous and low-noise. Detection strategies:

  • Auditd / Sysmon for Linux: Log execve syscalls and alert on recon patterns (sudo -l, find / -perm -4000, cat /etc/passwd)
  • EDR: Baseline normal admin activity; alert on recon from unexpected service accounts or web-server users
  • Honeypots: Canary files in /etc/passwd-adjacent paths or fake credentials in history

Related: windows-reconnaissance-commands, unix-permissions, bash-scripting, netcat, find-command