WHAT THE MANUALS SAY

Every command
is a short word.

The command line has its own vocabulary.

Most of it is shorthand: ls for list, pwd for print working directory, grep for an old editor command. Once you can read the words, you can tell which ones only look and which ones change things.

Check a command Read the short answer
A person seen from behind working at a laptop on a wooden desk in the evening, the screen glowing softly and out of focus
AI-generated image, not a photograph of a real person or place.
01 Know what it stands for02 Know what it changes03 Ask the manualShort words, clear meanings

THE SHORT ANSWER

Most commands are
abbreviations.

The names look cryptic, but most are shorthand.
Read the word and you know the job.

MOVING AROUND

ls, cd and pwd

The GNU manual calls ls the program that lists directory contents, and pwd prints the working directory. The POSIX standard says cd changes the working directory.

Check a command

SEARCHING

Where grep comes from

The GNU grep manual says the name comes from the old ed editor, where g/re/p meant global, regular expression, print: show every matching line.

See the history

POWER

sudo means su “do”

The sudo project describes it as su “do”: it lets an administrator give chosen users the power to run commands as root, with a record of what was run.

Use it carefully

A QUICK COMMAND CHECK

What does this
command change?

Pick a common command to see what its name means and how much it can change on your computer. The bar shows how much care it deserves before you press Enter.

Based on the GNU Coreutils manual and the sudo project's own description. General information, not advice for any particular system.

Command check

Choose a command
lsOnly looks

Short for list. It lists information about files and directories. With no name given, it lists the current directory, and by default it skips names that begin with a dot.

pwdOnly looks

Print working directory. It prints the name of the directory you are in, so you know where the next command will act.

cpWrites a copy

Copy. It copies files, and the copy is completely independent of the original. By default it does not copy directories.

mvRenames or moves

Move. It moves or renames files and directories. The -i option makes it ask before overwriting an existing file at the destination.

rmRemoves

Remove. It removes files, and with -r whole directories and their contents. The -i option makes it ask before removing each file.

Source: GNU Coreutils 9.12 manual, sections on ls, pwd, cp, mv and rm.

TWO NUMBERS WORTH KNOWING

The manual is old,
and well organised.

One figure on how the manual is divided,
one on how long sudo has been around.

THE MANUAL

Numbered sections in the man pages

9 sections

The man command's own page lists sections 1 to 9: 1 is for programs and shell commands, 8 for system administration commands, usually only for root, and 9 (non-standard) for kernel routines.

SUDO

When sudo was first written

≈ 1980

The sudo project says sudo was first conceived and implemented around 1980 at the Department of Computer Science at SUNY/Buffalo. An updated version was posted to Usenet in December 1985.

Sources: man(1) on man7.org; A Brief History of Sudo on sudo.ws.

A single old brass key on a ring resting on a dark wooden desk beside a small padlock
AI-generated image, not a photograph of a real person or place.

SAFER HABITS

Read the words,
then press Enter.

A few habits taken straight from the manuals make the command line less risky.

  1. Check where you areRun pwd before a command that changes files, so you know which directory it will act on.
  2. Look before you changeUse ls to see what is there. It only lists, so it is safe to run as often as you like.
  3. Ask to be askedAdd -i to mv or rm and they will ask before overwriting or removing each file.
  4. Keep sudo for when you need itsudo runs a command as root, the most powerful user. Use it only for the commands that truly need it.

THE MANUAL

When in doubt,
type man.

Almost every command has a manual page. Typing man ls shows the page for ls, and man looks through the numbered sections in order and shows the first page it finds.

Section 1 covers programs and shell commands, section 5 file formats such as /etc/passwd, and section 8 system administration commands, which are usually only for root.

A magnifying glass held over a tray of grey pebbles, picking out the one red pebble among them
AI-generated image, not a photograph of a real person or place.

QUESTIONS PEOPLE ASK

Frequently asked

What does ls stand for?

It is short for list. The GNU Coreutils manual describes ls as the program that lists information about files, including directories. By default it skips names that begin with a dot.

Why is it called grep?

The GNU grep manual says the name comes from the way line editing was done on Unix: in the ed editor, g/re/p meant global, regular expression, print, which shows every matching line.

What does sudo mean?

The sudo project describes it as su “do”. It lets a system administrator allow chosen users to run some or all commands as root or another user, and keeps an audit trail of the commands run.

Is cd a program like ls?

No. cd changes the working directory of the current shell, and the POSIX standard says that because of this it is always provided as a shell built-in rather than a separate program.

Can rm ask before deleting?

Yes. The GNU manual says rm -i prompts before removing each file, and rm -I prompts once if more than three files are named or a recursive removal is requested.

SOURCES

Where the facts come from

Each figure on this page comes from the sources below. Check them for the full detail and context.

  1. GNU Coreutils manual: ls, pwd, cp, mv and rm
  2. GNU Grep manual: what do grep, -E and -F stand for?
  3. man7.org: man(1), the system's manual pager
  4. The Open Group Base Specifications Issue 8: cd
  5. Sudo: What is Sudo?
  6. Sudo: A Brief History of Sudo