# System Informationuname-a# Full system infohostnamectl# Detailed host/OS infolscpu# CPU detailsfree-h# Memory usage human readabledf-h# Disk usage human readableuptime# System uptime and loadw# Who is logged in and what they're doinglast|head-n10# Last logged in usersdmesg|tail# Kernel messagescat/proc/cpuinfo# CPU informationcat/proc/meminfo# Memory information# System Monitoringtop# Task managerhtop# Enhanced task manageratop# Advanced system monitorvmstat1# Virtual memory stats (every 1 sec)mpstat-PALL1# CPU usage per coreiostat-xz1# IO statssar-u15# CPU usage (1 sec intervals, 5 times)sar-r15# Memory usagesar-b15# IO usageiotop# IO monitornethogs# Per-process network usageiftop# Network usage monitorperftop# CPU performance monitorstrace-pPID# Trace system callsltrace-pPID# Trace library calls# Process Managementpsaux# All processesps-ef|grepprocess# Find specific processpgrepprocess_name# Get process IDpkillprocess_name# Kill process by namekill-9PID# Force kill by PIDnice-n19command# Run with low priorityrenice10-pPID# Change process prioritypstree# Process treepidofprocess_name# Find PIDs of processfuser-mv/path# Show processes using path
File System Operations
# Basic Operationsls-lahR# List all files recursivelycp-avsourcedest# Copy with progressmv-vsourcedest# Move with verboserm-rfdirectory# Remove directory forcefullymkdir-ppath/dir# Create full directory pathln-stargetlink# Create symbolic linkreadlinksymlink# Show where symlink pointstree-L2# Directory tree, 2 levelsdu-sh*# Directory sizesncdu# NCurses disk usage# File Search & Text Processingfind/-namepattern# Find files by namefind/-typef-size+100M# Find large filesfind/-mtime+30# Files not modified in 30 dayslocatefilename# Quick file search (needs updatedb)grep-r"pattern"/path# Recursive text searchawk'{print $1}'file# Print first columnsed's/old/new/g'file# Replace textcut-d:-f1/etc/passwd# Cut specific fields# File Attributes & Permissionschmod755file# Change permissionschmod-Rg+wdirectory# Recursive group writechownuser:groupfile# Change ownershipchattr+ifile# Make file immutablelsattrfile# List special attributesgetfaclfile# Show ACL permissionssetfacl-mu:user:rwxfile# Modify ACL# Archive & Compressiontar-czfarchive.tar.gzdir/# Create gzip archivetar-xzfarchive.tar.gz# Extract gzip archivetar-cjfarchive.tar.bz2dir/# Create bzip2 archivetar-xjfarchive.tar.bz2# Extract bzip2 archivezip-rarchive.zipdirectory# Create zip archiveunziparchive.zip# Extract zip archivegzipfile# Compress filegunzipfile.gz# Decompress file
Network Operations
# Interface Managementipaddr# Show IP addressesiplinksetdeveth0up/down# Toggle interfaceiprouteshow# Show routing tabless-tuln# Show listening portsss-ta# Show all TCP connectionsnetstat-tulpn# Traditional port listingnmclidevstatus# NetworkManager statusnmcliconshow# Show connectionsiwconfig# Wireless interface infoiwdevwlan0scan# Scan for wireless networks# Network Testing & Monitoringpinghost# Basic connectivity testmtrhost# Traceroute and ping combinedtraceroutehost# Show route to hostdigdomain# DNS querynslookupdomain# Simple DNS querywhoisdomain# Domain registration infocurl-ILurl# HTTP headers onlywget-curl# Download with resumetcpdump-ieth0# Packet capturenmap-p-host# Port scaniperf3-s# Network speed test (server)iperf3-cserver# Network speed test (client)nethogs# Per-process bandwidthiftop# Bandwidth monitoring by IP# Network Configurationipaddradd192.168.1.100/24deveth0# Add IPiprouteadddefaultvia192.168.1.1# Add routeiptables-L-n-v# List firewall rulesufwstatus# UFW firewall statushostnamectlset-hostnamenew-name# Change hostnamesystemd-resolve--status# DNS resolver status
Storage Management
# Disk Operationsfdisk-l# List disk partitionsgdisk/dev/sda# GPT partition editorparted-l# List partitions (alternative)lsblk# List block devicesblkid# Show block device infosmartctl-a/dev/sda# Disk health infohdparm-tT/dev/sda# Disk speed test# LVM Managementpvs# List physical volumesvgs# List volume groupslvs# List logical volumespvcreate/dev/sdb# Create physical volumevgcreatevg0/dev/sdb# Create volume grouplvcreate-L10Gvg0# Create logical volumelvextend-L+5G/dev/vg0/lv0# Extend LVresize2fs/dev/vg0/lv0# Resize filesystem# RAID Managementmdadm--create/dev/md0--level=1--raid-devices=2/dev/sd[bc]1# Create RAIDmdadm--detail/dev/md0# RAID detailsmdadm--manage/dev/md0--add/dev/sdd1# Add disk to RAIDcat/proc/mdstat# RAID status# Filesystem Operationsmkfs.ext4/dev/sda1# Create ext4 filesystemmkfs.xfs/dev/sda2# Create XFS filesystemmount/dev/sda1/mnt# Mount filesystemumount/mnt# Unmount filesystemfstrim-av# TRIM SSDxfs_repair/dev/sda2# Repair XFS filesysteme2fsck-f/dev/sda1# Force ext4 filesystem check
Process & Performance Tuning
# System Controlsysctl-a# Show all kernel parameterssysctlvm.swappiness=10# Set kernel parameterulimit-n65535# Set file descriptor limitnice-n19command# Run with low priorityionice-c2-n0command# Set IO prioritychrt-f-p99PID# Set real-time priority# Performance Analysisperfrecord-a-g# Record system performanceperfreport# Show performance reportperftop# Real-time perf analysissar-u110# CPU usage (10 samples)sar-r110# Memory usagesar-b110# IO usagepidstat1# Per-process statisticsvmstat1# Virtual memory statsdstat# System resource stats# Memory Managementfree-h# Show memory usageswapon-s# Show swap usageswapoff-a# Disable all swapswapon-a# Enable all swapecho3>/proc/sys/vm/drop_caches# Clear cachesync&&echo3>/proc/sys/vm/drop_caches# Safer cache clear
Security & Access Control
# User Managementuseradd-muser# Create user with homeusermod-aGgroupuser# Add user to grouppasswduser# Set user passwordchage-luser# Password policy infolast# Show last loginswho# Show who is logged inw# Show who is logged in and what they're doing# File Permissionschmod750file# Change permissionschownuser:groupfile# Change ownershipumask027# Set default permissionsgetfaclfile# Show ACLsetfacl-mu:user:rwxfile# Set ACL# Security Monitoringfail2ban-clientstatus# Show banned IPsausearch-ksudo_cmds# Search audit logsaureport-au# Authentication reportlastlog# Last login reportgrep"Failed password"/var/log/auth.log# Failed logins# Firewall Managementiptables-L-n-v# List rulesiptables-AINPUT-ptcp--dport22-jACCEPT# Allow SSHufwallow22/tcp# UFW allow SSHufwstatus# UFW statusfirewall-cmd--list-all# firewalld rules
System Maintenance
# Package Managementaptupdate&&aptupgrade-y# Update (Debian/Ubuntu)dnfupdate# Update (RHEL/CentOS)apt-markholdpackage# Prevent package updatesapt-markunholdpackage# Allow package updatesdpkg-l|greppackage# List installed packagesrpm-qa|greppackage# List installed packages (RPM)apt-cachepolicypackage# Show package infodnfinfopackage# Show package info# Service Managementsystemctlstatusservice# Service statussystemctlstartservice# Start servicesystemctlenableservice# Enable at bootjournalctl-uservice# Service logsjournalctl-f# Follow system logsjournalctl--since"1 hour ago"# Recent logs# Backup Operationsrsync-avzsource/dest/# Sync directoriesrsync-avz-esshsource/user@host:dest/# Remote syncddif=/dev/sdaof=disk.imgbs=4M# Disk imagetar--exclude=/proc--exclude=/sys-czfbackup.tar.gz/# System backup
Virtualization & Containers
# Docker Operationsdockerps-a# List all containersdockerimages# List imagesdockerexec-itcontainerbash# Enter containerdocker-composeup-d# Start servicesdockerlogscontainer# Container logsdockerstats# Container resources# KVM/QEMU Managementvirshlist--all# List all VMsvirshstartvm_name# Start VMvirshshutdownvm_name# Shutdown VMvirsheditvm_name# Edit VM configvirt-install--name=vm--ram=2048# Create VM# LXC/LXD Containerslxclist# List containerslxclaunchubuntu:20.04container# Create containerlxcexeccontainerbash# Enter containerlxcstopcontainer# Stop containerlxcdeletecontainer# Delete container
Troubleshooting Commands
# System Diagnosisdmesg|tail# Kernel messagesjournalctl-xn50# Last 50 system log entriestop-b-n1# Process snapshotpsauxf# Process treelsof# List open filesstracecommand# Trace system callsltracecommand# Trace library calls# Network Troubleshootingpinghost# Basic connectivitytraceroutehost# Route tracingmtrhost# Continuous traceroutess-tuln# Open portsnetstat-i# Interface statisticstcpdump-ieth0# Packet capture# Disk & Filesystemiostat-xz1# IO statisticsiotop# IO monitoringsmartctl-H/dev/sda# Disk healthdf-h# Disk space usagedu-sh/*|sort-h# Directory sizeslsof+D/path# Files open in directory