Linux Fundamentals

Lesson 1 of 7

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.

📝 Command Line Quiz

Passing score: 70%
  1. 1.What is the main advantage of CLI commands over clicking through a GUI?

  2. 2.In "ls -l /home", -l is an argument and /home is a flag.

  3. 3.To see the current working directory in the terminal, you run: ____