Linux Commands Reference
The Linux commands you actually reach for — one page per command with common flags, real examples, and the gotcha that trips people up. Standard GNU/Linux behavior (not macOS BSD).
Files & Directories
ls
Lists directory contents including files and subdirectories. Supports detailed views, sorting, and filtering to inspect the filesystem quickly.
cp
Copies files and directories from one location to another. Preserves or transforms metadata depending on flags.
mv
Moves or renames files and directories. Within a filesystem it just relinks; across filesystems it copies then deletes.
rm
Removes files and, with -r, directory trees. Deletions are immediate and not recoverable from the shell.
mkdir
Creates one or more directories. Can create nested paths and set the mode of new directories in a single call.
ln
Creates hard or symbolic links between files. Symbolic links point to a path; hard links share the same inode.
Text Processing
cat
Concatenates files and prints them to standard output. Also useful as a simple viewer or to feed content into pipelines.
grep
Searches text for lines matching a regular expression. Central to log analysis and pipeline filtering.
sed
Stream editor that applies a small program to each line of input. Widely used for search-and-replace and inline file edits.
awk
Pattern-action language for processing columnar text. Excellent for reshaping tabular data, aggregating fields, and quick reports.
sort
Sorts lines of text. Supports numeric, human-numeric, reverse, unique, and keyed sorting.
wc
Counts lines, words, characters, and bytes in files or stdin. Frequently used at the end of pipelines to size results.
cut
Extracts sections from each input line by byte, character, or delimited field. Handy for pulling columns out of CSV or colon-delimited files.
head
Outputs the first part of files. Defaults to the first ten lines but can trim by any line or byte count.
tail
Prints the last part of files. Essential for log inspection, especially with the follow flag to stream new lines.
Processes
ps
Snapshots the current process list. Accepts both BSD-style and UNIX-style flags depending on how you want to slice the output.
top
Interactive real-time view of processes and system resource usage. Refreshes on an interval and supports live sorting and filtering.
kill
Sends a signal to one or more processes. Defaults to SIGTERM, allowing a process to clean up before exiting.
System
df
Reports filesystem disk-space usage. Shows total, used, and available space per mounted filesystem.
du
Estimates disk usage of files and directories. Great for hunting the source of a full filesystem.
free
Displays free and used memory including RAM and swap. Reads from /proc/meminfo and summarizes at a glance.
Networking
curl
Transfers data to or from a server across many protocols including HTTP, HTTPS, FTP, and SCP. The Swiss Army knife of ad-hoc HTTP requests.
ssh
Opens an encrypted shell session to a remote host. Also runs single remote commands and can tunnel arbitrary TCP ports.
rsync
Efficient file synchronizer that copies only the differences between source and destination. Works locally or over SSH.
dig
Queries DNS servers for records and diagnostics. Preferred over nslookup for scripting and detailed troubleshooting.