Linux Commands Reference

Comprehensive reference for linux commands reference covering essential concepts, practical examples, and production best practices.

Linux Commands Reference

This reference page collects the Linux commands most frequently needed when working on production servers, staging environments, or local development boxes that run a Unix-like operating system. It matters whenever you need to inspect, troubleshoot, or modify a system without leaving a terminal: diagnosing performance issues, cleaning up disk space, verifying network connectivity, managing services, or reviewing process state. The content is organised around common administrative tasks rather than by command category, so you can find what you need based on what you’re trying to accomplish. Every command shown ships with standard Linux distributions; no proprietary tools or invented CLIs are used.

## Finding and Inspecting Processes

When you need to see what’s running, identify a rogue daemon, or kill a stuck job, the ps family and its companions are the first port of call.

Sharp edges: ps output format varies between distributions. On some systems ps aux may not exist or may require the procps package. The top binary may be replaced by htop or gotop in custom images, changing available key bindings. pgrep and pkill rely on exact binary name matching; a symlink or a script wrapper may not be found. kill <PID> without a signal number sends SIGTERM; daemons that ignore SIGTERM will survive, requiring kill -9 <PID> (SIGKILL) which bypasses cleanup handlers and may leave state files or sockets in an inconsistent condition.

## Managing Files and Directories

Administrative file work—cleanup, migration, permission changes—relies on a small set of core utilities. Flags are portable across GNU and BSD variants, but behaviour differences exist.

Sharp edges: find pathnames containing spaces or special characters require proper quoting or -print0 paired with xargs -0 to avoid word‑splitting. rm -rf on a symlink removes the symlink target only if the target is not itself a directory being held open by another process. mv across filesystems copies then deletes the original, which can be slow and may lose extended attributes unless rsync -a is used instead. chmod 777 grants world‑readable/writable/executable; on multi‑user systems this often opens security gaps, and many sites enforce umask policies that silently override the explicit mode.

## Network Diagnostics and Connectivity

Verifying that a service is reachable, checking interface configuration, or debugging DNS resolution are routine tasks.

Sharp edges: ping requires no special privileges on Linux, but many ICMP filters in cloud environments or corporate firewalls silently drop echo requests, making a “no‑response” result ambiguous—it may indicate filtering rather than host unavailability. nc -zv can report a port as “open” if the kernel’s SYN‑ACK arrives before the application accepts the connection, which may not reflect the final service state. curl -I may still trigger a full request body download if the server redirects (301/302) or enforces HSTS; adding --max-time 5 bounds the wait. traceroute relies on ICMP time‑exceeded messages; some networks rate‑limit ICMP, causing incomplete traces or all‑star results. ss output may be truncated for very long command lines; ps -p <PID> -o args= can supplement it.

## User and Permission Administration

Managing who can do what, and under which account a process runs, is central to system security and operations.

Sharp edges: chmod on symbolic links only affects the link itself, not the target; chmod +x on a symlink to a script does not make the script executable if the target lacks the shebang or execute bit. sudo timestamp is per‑terminal; opening a new shell or waiting more than the default 5‑minute timeout requires re‑authentication (sudo -k then sudo). chown on directories with setgid bit set forces new files and subdirectories to inherit the group, but this behaviour does not apply to existing files—only newly created ones. visudo will refuse to save if the file contains unescaped % characters or mismatched Cmnd_Alias definitions, potentially locking out all sudo access until manually repaired.

## System Services and Daemons

Controlling long‑running processes, checking logs, and ensuring services start at boot are daily operations.

Sharp edges: systemctl operations are serialized through the system manager; if the manager is in a degraded state (e.g., disk full, journal corrupted), start/restart may silently fail and report activating indefinitely. journalctl disk usage grows unboundedly unless SystemMaxUse= is set in /etc/systemd/journald.conf; a saturated journal can prevent new entries from being written, masking service failures. systemctl mask is irreversible without manually removing the mask symlink and running daemon-reload; it is often used in container or immutable‑image workflows to disable unwanted daemons, but mistakenly masking a required system unit (e.g., networkd) can take the network offline until the mask is removed. daemon-reload after editing a unit file does not restart running instances; a manual restart is needed for changes to take effect.

## Sharp Edges – What Silently Fails and What You Learn Too Late

This page was rewritten on 14 October 2026. It replaced a templated version that was not specific to its own title. How these pages are written and checked. If anything here is wrong, tell us at [email protected] and we will correct it.