The Command Line
Every GUI is a layer of abstraction over what is actually happening. The command line strips it away.
Every time you use a computer, you are interacting with a layer of abstraction. The icons, windows, and drag-and-drop of the graphical user interface (GUI) are a translation — a visual metaphor layered over the actual operations happening beneath. It is a useful metaphor. But it hides things.
The command line strips it away.
The command line interface (CLI) is a text-based way of talking directly to the operating system. Instead of clicking an icon, you type a command. Instead of dragging a file into a folder, you write mv file.txt folder/. The computer does exactly what you say — no more, no less. This is both its virtue and its danger.
The filesystem as a tree
To use the command line effectively, you need a mental model of the file system. It is a tree: a hierarchy of directories (folders), each containing files and sub-directories, branching outward from a root. Your home directory sits near the top of the relevant branch. Everything descends from there.
Navigation in this tree is sequential. You cannot teleport from one location to another — you follow a path. A path is a sequence of directories separated by forward slashes: Desktop/Projects/notes.txt. The tilde (~) is shorthand for your home directory. Two dots (..) step one level up.
This matters because the terminal only knows where it is, what’s immediately around it, and the path it took to get there. If you ask it to move somewhere it cannot see from its current location, it fails — and it will tell you so. The error message is not mysterious once you have the model. It just means: the thing you named isn’t in the place I’m looking.
Core commands
A small set of commands handles most of what you’ll need:
ls— list the contents of the current directorycd [path]— change directory;cdalone returns to homemkdir [name]— create a directorytouch [name]— create an empty filemv [source] [destination]— move a file; also used to rename (renaming is moving within the namespace)rm [file]— remove a file;rm -r [directory]removes a directory and everything inside itcat [file]— read and display file contents
Most commands accept flags — modifiers that change their behaviour. ls -F appends a trailing slash to directories, distinguishing them from files. Flags take the form of a hyphen followed by a letter: command -flag.
Recursion
The -r flag on rm deserves a moment’s attention. Removing a directory is not like removing a file — a directory is a container, potentially containing other containers. The -r flag tells the computer: delete this, and anything inside it, and anything inside that, repeating until nothing remains. This is recursion — applying a procedure repeatedly to smaller components of a problem until there is nothing left to apply it to.
Recursion appears everywhere in computer science. Its first practical appearance for most people is in a delete command. That is appropriately clarifying.
Power and danger
The command line does not ask for confirmation. There is no Trash. rm removes. rm -r removes thoroughly. The graphical interface wraps dangerous operations in safety nets — “Are you sure?” dialogs, recoverable deletions. The CLI assumes you mean what you type.
This is not a reason to avoid it. It is a reason to be deliberate. The same directness that makes the command line powerful makes its mistakes hard to recover from.
Know what you’re typing. Check before you remove. The -i flag (interactive) on rm will at least ask you before deleting each item — a reasonable precaution when you’re unsure.
The command line is not a curiosity or a throwback. For anyone working directly with code, data, or systems, it is the most efficient interface available. More importantly, using it builds an accurate mental model of how a computer actually works — one that carries over into everything you do in the field.
The GUI makes the computer feel like furniture. The CLI makes it feel like what it is.