Command Line & Terminal

The command line is the most durable, composable interface in software. Decades of GUIs have come and gone, but the terminal remains how developers do real work — running builds and tests, managing Git, operating servers, automating tasks, and gluing tools together. Fluency in the shell is a force multiplier: tasks that take minutes of clicking become a one-line command you can repeat, script, and share.

The deeper power is composability. Unix tools each do one thing well and connect through pipes, so you assemble small commands into exactly the operation you need. Learning the shell isn't memorizing a hundred commands — it's understanding a handful of building blocks (commands, pipes, redirection, flags) that combine endlessly.

TL;DR

Quick Example

The Unix philosophy in one line — small tools piped together:

The Shell

A shell is the program that interprets your commands — bash (ubiquitous default), zsh (macOS default, richer), and fish (friendly, modern) are the common ones. It provides command execution, history, tab completion, variables, and scripting. (For shell scripting as a language, see Bash.)

Essential Building Blocks

Pipes & Redirection

This is what makes the command line powerful — connect simple tools into pipelines:

Productivity Habits

Best Practices

Common Mistakes

Running destructive commands carelessly

Copy-pasting commands you don't understand

FAQ

Which shell should I use — bash, zsh, or fish?

Bash is the universal default — it's everywhere (servers, containers, scripts), so knowing it is non-negotiable for scripting and remote work. Zsh (the macOS default) is bash-compatible with nicer interactive features and a big plugin ecosystem (Oh My Zsh) — a great daily driver. Fish is the friendliest out of the box (autosuggestions, syntax highlighting) but isn't POSIX-compatible, so write portable scripts in bash even if you use fish interactively. For interactive use, pick zsh or fish; for scripts, know bash. See Bash.

Why bother with the terminal when GUIs exist?

Because the command line is faster, scriptable, composable, and universal. Repetitive GUI clicking becomes a one-line command you can repeat, automate, and share; many tools (Git, package managers, build systems, cloud CLIs, servers) are command-line-first or command-line-only; and remote machines often have no GUI at all. The terminal's composability — piping small tools together — lets you build operations no single GUI offers. It has a learning curve, but the payoff in speed and capability compounds over your whole career.

What do pipes and redirection actually do?

A pipe (|) connects the output of one command to the input of the next, letting you chain simple tools into a pipeline (cat log | grep error | wc -l counts error lines). Redirection sends a command's output to a file (> file overwrites, >> file appends) or feeds a file as input (< file), and 2> redirects error output specifically. Together they embody the Unix philosophy: each tool does one thing well, and you compose them to accomplish complex tasks without any single monolithic program.

Which modern CLI tools are worth learning?

Several modern tools are large upgrades on the classics: ripgrep (rg) for fast, smart text search (faster than grep, respects gitignore), fd for finding files, fzf for fuzzy-finding anything interactively (files, history, branches), jq for slicing JSON, and bat as a syntax-highlighting cat. They keep the same composable, pipe-friendly philosophy while being faster and more ergonomic. Adopting rg, fzf, and jq alone meaningfully speeds up everyday terminal work.

Related Topics

References