Computing and the Command Line

The Terminal, the Shell, and the Prompt

The shell is a program that reads commands and runs other programs; the terminal is the window it lives in. Bash is the standard shell on Linux. Read the prompt (user, host, working directory, $ or #), split a command into the program, options, and arguments, quote spaces, run a first handful of commands, and learn why Ctrl-C doesn't copy in a terminal.

  • 6 min
  • 7 steps
  • 3 questions
  • Lesson 1 of 80

In this lesson

  1. Two programs, not one
  2. Reading the prompt
  3. The shape of a command
  4. First commands
  5. Keys that work differently here
  6. Your turn
  7. So

Two programs, not one

When people say “the command line,” they mean the shell: a program that takes the commands you type and passes them to the operating system to carry out 1. On almost every Linux system the shell is bash, the GNU Project’s “Bourne Again SHell,” an enhanced replacement for sh, the original Unix shell written by Steve Bourne 1.

The window you type into is a different program, a terminal emulator. It draws text and passes your keystrokes to the shell. GNOME’s is called Terminal (gnome-terminal), KDE’s is Konsole; on most Linux desktops Ctrl-Alt-T opens one 1 2. On Windows, Windows Terminal can host PowerShell, the old cmd, or a Linux shell under WSL, which is the next lesson.

Other shells exist. zsh (the default on Macs) and fish add conveniences, but bash is the one installed everywhere and the one scripts and install instructions assume, so it’s the one to learn first. The ideas carry straight over 2.

Why bother, when there’s a mouse? Because a graphical program can only do what its buttons offer. The shell lets you combine small programs into new tools, repeat work exactly, and automate it. It’s also the only interface on most servers, and the language of nearly every “how to install this” page 2.

A terminal showing me@linuxbox:~/photos$ ls -l --sort=time "Summer 2026", with brackets under each part: me is the user, linuxbox the computer name, ~/photos where you are, $ means an ordinary user and # means root, ls the command, -l a short option, --sort=time a long option with a value, and "Summer 2026" the argument, quoted because it has a space. Below: stack short options, ls -la equals ls -l -a; long options are words, ls --all equals ls -a; spaces split words, so write "My Photos" or My\ Photos.
Every command line has the same shape: program, options, arguments. Credit: StudyCorner diagram · CC BY 4.0 · Source

Quick check

What’s the difference between the terminal and the shell?

Reading the prompt

Open a terminal and you’ll see something like:

me@linuxbox:~$

That’s the prompt, the shell saying it’s ready 1. Reading left to right:

  • me: your user name.
  • linuxbox: the computer’s name (its hostname).
  • ~: the current working directory, the folder you’re “in.” ~ is shorthand for your home directory, /home/me.
  • $: you’re an ordinary user. If it ends in #, the shell is running as root, the superuser, who can change anything on the system 1 2.

Distributions dress the prompt differently (Fedora shows [me@linuxbox ~]$), but the pieces are the same. You’ll customize it in a later module.

Quick check

A prompt ends in # instead of $. What does that tell you?

The shape of a command

Type something nonsensical and press Enter:

me@linuxbox:~$ kaekfjaeifj
kaekfjaeifj: command not found

The shell couldn’t find a program by that name and gives you another prompt 1. Nothing breaks.

A real command has three kinds of parts:

me@linuxbox:~$ ls -l --sort=time Documents
  • The command: the first word, ls, is the program to run.
  • Options change how it behaves. Short options are one dash and a letter (-l), and can be stacked: ls -la is ls -l -a. Long options are two dashes and a word (--all), sometimes with a value (--sort=time).
  • Arguments say what to work on: here, the Documents folder.

The shell splits the line at spaces before the program sees it: the first word is the program, the rest are handed to it as separate arguments 2. That’s why a name with a space in it needs protecting, either with quotes or by escaping the space with a backslash 2:

me@linuxbox:~$ ls "My Photos"
me@linuxbox:~$ ls My\ Photos

Without them, ls My Photos looks for two things, My and Photos, and complains about both.

Quick check

How does the shell treat: cp My Photos backup

First commands

Try each of these. None of them changes anything 1 2.

me@linuxbox:~$ date
Sun Oct  4 21:05:12 CDT 2026
me@linuxbox:~$ echo hello world
hello world
me@linuxbox:~$ whoami
me
me@linuxbox:~$ uptime
 21:05:20 up 3 days,  4:41,  1 user,  load average: 0.08, 0.12, 0.10
me@linuxbox:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       234G   61G  161G  28% /
me@linuxbox:~$ free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi       4.1Gi       6.3Gi       312Mi       5.2Gi        11Gi
  • date: the date and time.
  • echo: prints its arguments back. Handy for checking what the shell did to your words.
  • whoami: your user name.
  • uptime: how long since boot, and how busy the machine has been.
  • df -h: free disk space, -h for human-readable sizes like 161G.
  • free -h: memory in use.

Your numbers will differ. To leave, type exit or press Ctrl-D on an empty line 1.

Keys that work differently here

Press the up arrow: your last command comes back, ready to edit with the left and right arrows. Most distributions remember your last 1,000 commands 1.

Ctrl-C does not copy in a terminal. It’s far older than Windows and means interrupt: stop the program that’s running. Copy and paste are Ctrl-Shift-C and Ctrl-Shift-V 1. (Windows Terminal will also copy selected text with Ctrl-C, but get used to Ctrl-Shift; it works everywhere.)

Try it: run ping 8.8.8.8, a program that runs until stopped, then press Ctrl-C.

Lecture 1: Course Overview + Introduction to the Shell MIT's Missing Semester, 2026, lecture 1. Watch with a terminal open and type along. Credit: The Missing Semester of Your CS Education (MIT) · YouTube standard license · 1:14:43 · Source

Playback is optional. If the player is unavailable, open the video at its source.

Your turn

Exercises

  1. Run echo $SHELL. What does it print, and what does that tell you?
  2. Run echo one two three (with extra spaces), then echo "one two three". Why are the outputs different?
  3. Run ls -la and ls -l -a. Are the outputs the same?
  4. Without running it, how many arguments does touch my file.txt pass to touch? What would it create?
Answers
  1. Something like /bin/bash or /usr/bin/bash: the path of your login shell. If it says /usr/bin/zsh, you’re running zsh, which handles everything in this module the same way.
  2. Unquoted, the shell splits the line into words and throws away the extra spaces, so echo gets three arguments and prints them with single spaces. Quoted, it’s one argument, spaces and all.
  3. Yes. Short options stack.
  4. Two: my and file.txt. touch would create two empty files with those names. To make one file, write touch "my file.txt", or better, avoid spaces in names you’ll type often: my-file.txt.

So

The shell reads what you type, splits it into words at the spaces, runs the first word as a program, and hands it the rest as options and arguments. The prompt tells you who you are, where you are, and whether you’re root. Next: getting a real Linux shell on a Windows PC.

Lesson complete

Nice work.

1day streak
0/1today's goal
–correct

Up next · 6 min

A Linux Shell on Windows: WSL

Next lesson
Sources for this lesson
  1. 1
    William Shotts. The Linux Command Line, Seventh Internet Edition (25.12A). LinuxCommand.org (print edition by No Starch Press). 2026. verifiedFree CC BY-NC-ND 3.0 book, release 25.12A of July 18, 2026. Part 1, Learning the Shell: the shell and terminal emulators, prompts ($ vs. # for the superuser), command history (most distributions keep the last 1,000 commands), Shift-Ctrl-C/V for copy and paste; navigation and the directory tree; exploring the system (ls options and the long listing, file, less, the guided tour of /, symbolic links); manipulating files (wildcards and character classes, mkdir, cp, mv, rm, ln; no undelete, test wildcards with ls first); working with commands (four kinds of commands, type, which, help, --help, man and its sections, apropos, whatis, info, alias); redirection; expansion and quoting; Readline keyboard tricks, completion, history search; permissions; processes. Later parts cover the environment, vi, packages, storage, networking, find, archiving, regular expressions, text processing, and shell scripting.
  2. 2
    Anish Athalye, Jon Gjengset, Jose Javier Gonzalez Ortiz. Course Overview + Introduction to the Shell (The Missing Semester of Your CS Education, 2026). MIT CSAIL. 2026. verifiedCC BY-NC-SA lecture notes. The shell is a textual interface for running programs and wiring them together; a terminal is the visual interface to it. Bash is the most widely used shell (zsh and fish are popular alternatives); on Windows use WSL or a Linux VM. The shell splits a command at whitespace: first word the program, the rest arguments; quote or backslash-escape spaces. man and --help, plus tldr for examples; cd is a shell builtin; Tab completion; pwd and $PWD; absolute vs. relative paths, . and ..; $PATH lists the directories searched for programs, which shows the one found. Basic tools cat, sort, uniq, head, tail, grep.