Essential Linux Commands by Category

A quick-reference tour of the Linux commands used most often, organized by what they are actually for rather than as one long alphabetical list.

File and directory navigation

`ls` lists directory contents, `cd` changes directories, `pwd` prints your current path, and `find` searches the filesystem by name, type, or other criteria. These are usually the first commands anyone learns, since almost everything else builds on knowing where you are.

Creating, copying, and removing files

`cp` copies files or directories, `mv` moves or renames them, `rm` deletes them (with `-r` for directories), and `mkdir` creates a new directory. `rm` has no undo, which is why many people alias it to prompt for confirmation before deleting.

Permissions and ownership

`chmod` changes read/write/execute permissions on a file, using either symbolic notation (like `u+x`) or numeric notation (like `755`), while `chown` changes which user and group own a file. Getting these wrong is a common source of "permission denied" errors.

Searching and processing text

`grep` searches text for a pattern, `sed` edits text in a stream (commonly for find-and-replace), and `awk` processes structured text column by column. These three are frequently combined with pipes to filter and transform command output on the fly.

Viewing and controlling processes

`ps` lists running processes, `top` (or `htop`) shows live resource usage, and `kill` sends a signal to stop a process by its process ID. `kill -9` forcibly terminates a stuck process when a normal `kill` does not work.

Networking and archiving

`ssh` opens a secure remote shell to another machine, `curl` or `wget` download content from a URL, and `tar` bundles (and optionally compresses) files into a single archive, commonly seen as a `.tar.gz` file.

Why piping commands together matters

The real power of the Linux command line comes from combining small, single-purpose commands with the pipe operator (`|`), which sends one command's output directly into another as input. A command like `ps aux | grep firefox` lists all processes and filters that output down to just the ones matching "firefox," rather than needing a single command that does both jobs.

man pages are the built-in reference

Every standard command has a manual accessible by typing `man` followed by the command name (for example, `man grep`), which documents every available flag and option in detail. This is worth checking before searching online, since it always matches the exact version installed on your system.

Frequently Asked Questions

Do these commands work the same on macOS?

Many do, since macOS is Unix-based, but some commands behave slightly differently (for example, certain `sed` or `tar` flags differ between the GNU versions on Linux and the BSD versions on macOS). Checking the local `man` page is the safest way to confirm exact behavior.

What's the safest way to practice these without risking my system?

A virtual machine, a cloud-based Linux sandbox, or the Windows Subsystem for Linux (WSL) all provide an isolated environment where mistakes like a bad `rm` command cannot affect your main system.