The Command Line
A command-line interface (CLI) lets you control a computer by typing text commands instead of clicking through menus. It looks intimidating at first, but it's often faster and, crucially, scriptable: anything you can type, you can save and re-run automatically.
Why text beats clicking
- A CLI command can be copy-pasted, shared, and reproduced exactly, a screenshot of "click here, then here" cannot.
- Commands compose: the output of one command can feed directly into another (more on that soon).
- Almost every server in the world has no graphical interface at all, the CLI isn't a retro curiosity, it's how most computing actually happens.
Your first commands
whoami # who am I logged in as?
pwd # print working directory, where am I?
echo "hi" # print text
date # current date and time
Every command follows roughly the same shape: a program name, optionally followed by flags (options, usually starting with -) and arguments (the things it operates on):
ls -l /home
# ^command ^flag ^argument
ls lists files, -l is a flag asking for the "long" (detailed) format, /home is the argument telling it which directory to list. You'll see this exact pattern, command, flags, arguments, in nearly every tool covered in this course.
TIP
Stuck on what a command does or which flags it accepts? Almost every command supports --help, e.g. ls --help. That's always your first move, not memorization.