System Information
Admin
Pentest
Basic System Info
uname -a
Displays all system information - kernel version, architecture, hostname
cat /etc/issue
Shows distribution name and version - login banner information
cat /etc/*release*
Displays detailed distribution release information - more comprehensive than /etc/issue
hostname
Shows the system's hostname
hostnamectl
Systemd command for hostname control and information - shows additional system details
Environment & Kernel
env
Lists all environment variables - contains sensitive data like API keys, paths, and configurations
printenv
Alternative to env for printing environment variables
echo $PATH
Displays PATH variable - useful for privilege escalation via path hijacking attacks
Hardware Enumeration
Admin
CPU & Memory
lscpu
Detailed CPU architecture information - shows CPU model, cores, architecture, and more
lsmem
Memory information and statistics - shows memory blocks and availability
free -h
Memory usage in human readable format - shows total, used, and free memory
Devices & Peripherals
lspci
List all PCI devices with details - shows graphics cards, network adapters, etc.
lsusb
List USB devices and buses - shows connected USB devices
User & Group Enumeration
Pentest
CTF
Current User Info
id
Shows current user's UID, GID, and group memberships - essential for understanding privileges
sudo -l
Lists commands current user can run with sudo - common privilege escalation vector
All Users
cat /etc/passwd
Lists all users on the system - with their home directories and default shells
getent passwd
Alternative method using getent database - works with various name services
ls -la /home/
Shows home directories and their permissions - useful for finding readable directories
Network Information
Pentest
Admin
Network Configuration
ifconfig
Displays network interfaces, IP addresses, and MAC addresses - traditional command
ip addr
Modern alternative to ifconfig with more details - preferred on newer systems
netstat -tulpn
Shows listening ports and associated processes - TCP/UDP connections
DNS & Routing
cat /etc/resolv.conf
Displays DNS servers configured for the system
cat /etc/hosts
Shows local hostname to IP mappings - can be hijacked for redirection attacks
netstat -rn
Shows routing table - useful for network mapping and understanding network topology
File System Enumeration
CTF
Pentest
Special Permission Files
find / -perm -u=s -type f 2>/dev/null
Finds SUID binaries - common privilege escalation vector (runs as owner)
find / -perm -g=s -type f 2>/dev/null
Finds SGID binaries - less common but similar to SUID (runs as group)
find / -perm -o+w -type f 2>/dev/null
Finds world-writable files - potential for modification by any user
getcap -r / 2>/dev/null
Finds files with Linux capabilities - alternative to SUID for privilege escalation
Mount Points & Disks
mount
Shows mounted filesystems and their permissions
df -h
Shows disk usage in human readable format
Credentials & Secrets
Pentest
CTF
SSH Keys
find / -name "id_rsa" -o -name "id_dsa" -o -name "*.pem" 2>/dev/null
Searches for SSH private keys - common credential storage locations
ls -la ~/.ssh/
Checks SSH directory for authorized keys and known hosts
Configuration Files
find / -name "*.conf" -o -name "*.cfg" | xargs grep -i "pass\|pwd" 2>/dev/null
Searches configuration files for password strings - finds hardcoded credentials
history
Displays command history - may contain passwords or sensitive operations
Quick Wins & Common Findings
These are the most common privilege escalation vectors and quick checks:
sudo -l
Always check sudo permissions first - this is the most common privilege escalation path.
find / -perm -4000 2>/dev/null
SUID binaries are the second most common privilege escalation vector.
cat /etc/crontab
Cron jobs running as root that you can influence are a common vector.
getcap -r / 2>/dev/null
Capabilities are becoming more common than SUID in modern systems.
Essential One-Liners
CTF
Pentest
Quick Enumeration
echo "=== SYSTEM ==="; uname -a; echo "=== USERS ==="; cat /etc/passwd; echo "=== SUDO ==="; sudo -l; echo "=== PROCESSES ==="; ps aux; echo "=== NETWORK ==="; ifconfig; netstat -tulpn
Basic enumeration one-liner - quick assessment of system state
for i in $(ls /home/); do echo "=== $i ==="; sudo -l -U $i; done 2>/dev/null
Check sudo privileges for all users - finds users with sudo access
find / -type f -name "*.txt" -o -name "*.conf" -o -name "*.sh" -o -name "*.py" 2>/dev/null | head -50
Find interesting files quickly - common file types that may contain useful information
Pro Tips
2>/dev/null
Append this to commands to suppress permission denied errors and clean up output
Professional Tips
Remember: Always ensure you have proper authorization before running enumeration commands on systems you don't own. This cheatsheet is for educational purposes and authorized penetration testing only.
Methodology: Start with automated tools (LinPEAS/LinEnum), then manually verify findings. Always document your process and findings.