Files & Directories
ls -lahLists files with permissions, owner, human-readable size, and includes hidden files.
find . -name '*.log' -mtime +7Finds files matching a name pattern, modified more than 7 days ago.
cp -r SOURCE_DIR DEST_DIRCopies a directory recursively.
rm -rf DIR_NAMEDeletes a directory and everything in it, without confirmation. No undo, no trash — verify the path before running this.
tar -czvf archive.tar.gz DIR_NAMECreates a gzip-compressed tarball of a directory.
tar -xzvf archive.tar.gzExtracts a gzip-compressed tarball into the current directory.
Permissions
chmod 755 script.shSets owner read/write/execute, group and others read/execute — the standard mode for an executable script others need to run but not modify.
chown user:group FILE_NAMEChanges a file's owning user and group.
chmod -RApplies a permission change recursively through a directory tree — combine with a mode, e.g. chmod -R 644 DIR_NAME.
Processes
ps auxLists every process on the system with CPU/memory usage, owning user, and command line.
ps aux | grep nginxFilters the process list to a specific name.
topLive, auto-refreshing view of processes sorted by CPU usage.
kill PIDSends SIGTERM to a process, requesting graceful shutdown.
kill -9 PIDSends SIGKILL — terminates immediately with no chance for the process to clean up, close files, or flush buffers. Use only after a plain kill hasn't worked.
nohup ./long-task.sh &Runs a command immune to hangup signals and detached into the background, so it survives the terminal session closing.
CPU & Memory
topShows live per-process CPU and memory usage, plus system-wide load average.
free -mShows total, used, and free memory and swap in megabytes.
uptimeShows how long the system has been up and the 1/5/15-minute load averages.
nprocPrints the number of available CPU cores — useful context for interpreting a load average.
Disk Usage
df -hShows disk space usage per mounted filesystem in human-readable units.
du -sh *Shows the disk usage of each item in the current directory, summarized rather than listing every file inside.
du -sh /var/log/* | sort -rh | head -10Finds the 10 largest items under a directory — the fastest way to locate what's actually eating disk space.
lsof +L1Lists open files with a link count of zero — a deleted-but-still-open file, which keeps holding disk space until the process closes it.
Networking
ip addrShows network interfaces and their assigned IP addresses.
ss -tulpnLists listening TCP/UDP sockets with the owning process — the modern replacement for netstat.
curl -I https://example.comFetches only the response headers, for a quick check that a service is up and what it's returning.
ping -c 4 8.8.8.8Sends 4 ICMP echo requests to test basic reachability.
traceroute example.comShows the network hops a packet takes to reach a host — useful for isolating where latency or a drop is happening.
SSH
ssh user@hostOpens an interactive SSH session.
ssh -i ~/.ssh/key.pem user@hostConnects using a specific private key instead of the default identity.
scp file.txt user@host:/remote/path/Copies a local file to a remote host over SSH.
ssh-keygen -t ed25519 -C 'you@example.com'Generates a new SSH keypair using the modern ed25519 algorithm.
Services (systemd)
systemctl status nginxShows whether a service is running, its recent log lines, and its enabled/disabled state.
systemctl start nginxStarts a service immediately.
systemctl restart nginxStops and starts a service in one step — the usual way to apply a config change.
systemctl enable nginxConfigures a service to start automatically on boot, without starting it now.
systemctl daemon-reloadReloads systemd's unit files after editing one — required before a changed unit file takes effect.
Logs
journalctl -u nginxShows the systemd journal for a specific service.
journalctl -u nginx -fStreams a service's journal live, like tail -f.
journalctl --since '1 hour ago'Filters the journal to a relative time window across all units.
tail -f /var/log/syslogStreams a plain log file live. Use /var/log/messages on RHEL-family distributions instead.
Packages
apt update && apt install PACKAGE_NAMERefreshes the package index, then installs a package (Debian/Ubuntu).
yum install PACKAGE_NAMEInstalls a package on RHEL/CentOS-family distributions.
dpkg -l | grep PACKAGE_NAMEChecks whether a package is installed and its version (Debian/Ubuntu).
Find & Grep
find / -type f -name '*.conf' 2>/dev/nullFinds files by name across the filesystem, discarding permission-denied noise.
grep -rn 'ERROR' /var/log/app/Searches recursively for a pattern, printing matching line numbers.
grep -c 'timeout' access.logCounts matching lines instead of printing them.
Cron
crontab -eOpens the current user's crontab for editing.
crontab -lLists the current user's scheduled cron jobs.
Cron syntax
minute hour day-of-month month day-of-week command — 0 3 * * * runs daily at 03:00, */15 * * * * runs every
15 minutes.
See the Linux Troubleshooting tab for disk-full and high-load diagnostic walkthroughs.