Overview
Almost everything distinctive about working with Linux happens through a small set of composable command-line building blocks: navigating and manipulating files, understanding the permission model that decides who can do what to them, inspecting and controlling running processes, and configuring the networking and background services a machine actually runs. Every other Linux topic on this site - the Filesystem Hierarchy Standard, process management internals, storage, networking, users and groups, logging - goes deep on one of these areas. This one is the map: the everyday commands from each area, in the shape you'll actually reach for them, before you need the deeper dive.
Quick Reference
| Concept | What it is | Note |
|---|---|---|
| Shell | The interactive command interpreter running the commands below | bash is the most common default, zsh is common on macOS |
| Kernel | The core process managing hardware, memory, and processes | Everything else, including the shell, runs as a process on top of it |
| Process | A running instance of a program, identified by a PID | Inspected and controlled with ps, top, kill |
| Filesystem Hierarchy Standard | The standardized directory layout (/etc, /var, /usr...) | Full breakdown in Linux Filesystem Hierarchy & Permissions |
| systemd unit | A managed, restartable background service | Controlled with systemctl, logged via journalctl |
The commands below are grouped by task, not alphabetically - not exhaustive (see the GNU Coreutils manual for every flag), but the set that covers almost all daily shell work.
| Command | Description | Copy |
|---|---|---|
pwd | Print the current working directory. | |
ls -la | List every file in the current directory, including hidden ones, in long format. | |
cd <dir> | Change the current directory. | |
mkdir -p <path> | Create a directory, including any missing parent directories. | |
cp -r <src> <dst> | Copy a file or directory recursively. | |
mv <src> <dst> | Move or rename a file or directory. | |
rm -rf <dir> | Remove a directory and its contents recursively, without confirmation. | |
cat <file> | Print a file's entire contents to standard output. | |
less <file> | View a file's contents one screen at a time. |
| Command | Description | Copy |
|---|---|---|
ls -l | Show permissions, owner, and group for files in a directory. | |
chmod 755 <file> | Set exact read/write/execute permissions for owner, group, and others via octal mode. | |
chmod u+x <file> | Add execute permission for the file's owner, leaving other bits untouched. | |
chown user:group <file> | Change a file's owner and group. | |
umask | Show (or set) the default permission mask applied to every newly created file. | |
sudo <command> | Run a single command with root privileges. |
| Command | Description | Copy |
|---|---|---|
ps aux | List every running process on the system. | |
top | Live, continuously updating view of running processes and resource usage. | |
kill <pid> | Send SIGTERM, asking a process to terminate gracefully. | |
kill -9 <pid> | Send SIGKILL, forcing immediate termination. | |
<command> & | Run a command in the background of the current shell. | |
jobs | List background jobs started from the current shell. | |
nohup <command> & | Run a command immune to hangups, so it keeps running after the shell exits. |
| Command | Description | Copy |
|---|---|---|
ip a | Show network interfaces and their assigned IP addresses. | |
ping <host> | Test network-layer reachability of a host. | |
ss -tulpn | List listening TCP/UDP sockets and the process using each. | |
curl -I <url> | Fetch just the HTTP response headers for a URL. | |
ssh user@host | Open an interactive remote shell over SSH. | |
scp <file> user@host:<path> | Copy a file to a remote host over SSH. | |
ssh-copy-id user@host | Install your public key on a remote host to enable passwordless login. |
| Command | Description | Copy |
|---|---|---|
systemctl status <service> | Show whether a systemd service is running, plus its most recent log lines. | |
systemctl start <service> | Start a service now, for the current boot session only. | |
systemctl enable --now <service> | Start a service now and configure it to also start automatically on every future boot. | |
journalctl -u <service> -f | Stream a systemd service's logs live. | |
tail -f /var/log/syslog | Stream a log file live as new lines are appended. |
| Command | Description | Copy |
|---|---|---|
df -h | Show disk space usage per mounted filesystem, in human-readable units. | |
du -sh <dir> | Show the total size of a directory, in human-readable units. | |
find <path> -name "<pattern>" | Find files by name under a directory tree. | |
grep -ri "<pattern>" <path> | Recursively, case-insensitively search file contents for a pattern. |
Syntax
command [options] [arguments]
# e.g.
grep -r --include="*.log" "ERROR" /var/log/app# Chaining: pipe output from one command into the next
# The [n]ode bracket trick keeps grep's own process out of its own match
ps aux | grep [n]ode | awk '{print $2}'Examples
find /var/log -name "*.log" -mtime -1
grep -c "ERROR" /var/log/app/current.logjournalctl -u nginx.service --since '1 hour ago'Filter a systemd service's logs to a relative time window, far faster than scrolling a full log file looking for when something started.
journalctl -u nginx.service --since '1 hour ago'
Visual Diagram
Common Mistakes
- Running
rm -rfwith a mistyped or unset variable in the path, deleting far more than intended; there is no undo, so double-check any command with-rfbefore running it. - Reaching for
kill -9as the default, skipping the graceful SIGTERM shutdown that lets a process close files and finish in-flight work cleanly. - Editing a config file directly as root over SSH without a backup, discovering a syntax error only after the service that depends on it fails to restart.
- Assuming
pingsucceeding means an application is reachable; it only confirms network-layer connectivity, not that any specific service is listening or healthy. - Forgetting
systemctl enable, so a manually started service works fine until the next reboot, when it silently doesn't come back.
Performance
grep -ron a very large directory tree is far slower than a tool that respects.gitignore-style excludes; scope searches to the smallest relevant directory when possible.findwalks the filesystem tree directly and can be slow across network mounts or very large directories; narrowing with-maxdepthor a more specific starting path helps significantly.- Piping large outputs through several processes (
ps aux | grep ... | awk ...) is usually fine, but each pipe stage is its own process; for performance-sensitive scripts, a singleawkorgrepinvocation with the right flags often replaces a whole pipeline.
Best Practices
- Prefer
systemctl enable --nowover separatestart/enablecalls when bringing a new service into permanent use, so you never forget the reboot half of the equation. - Use
journalctl -u <service>and--since/--untilfilters instead of grepping through raw log files by hand. - Reach for SIGTERM (
kill, notkill -9) first, and only escalate to SIGKILL if a process genuinely won't respond after a reasonable wait. - Test connectivity at the layer you actually care about -
ss -tulpnorcurlfor "is this application reachable," not justping. - Keep destructive commands (
rm -rf,chmod -R,chown -R) deliberate: confirm the target path withpwd/lsimmediately before running them, especially over SSH on a remote host.