Linux & the Command Line

What the Shell Is and Why It Matters

20 min

The command line is a text conversation with your computer. You type a command, press Enter, and the computer answers. Servers, Docker containers, CI pipelines and cloud machines usually have no desktop at all, so the shell is the only way in. Learning it once pays off for your whole career.

Terminal, shell, prompt

  • Terminal: the window that shows text (Windows Terminal, macOS Terminal, the one in VS Code).
  • Shell: the program inside it that reads your commands. On Linux it is usually Bash or Zsh.
  • Prompt: the text waiting for input, for example panda@devbox:~$. It tells you the user (panda), the machine (devbox) and the current folder (~, your home folder). $ means a normal user; # means you are root, the all-powerful administrator.

The shape of every command

ls -la /var/log
Part Meaning
ls the command (list files)
-la options (also called flags): -l long format, -a include hidden files
/var/log the argument: what to act on

Short options use one dash and can be combined (-la is -l -a). Long options use two dashes and are easier to read: ls --all.

Getting help without leaving the terminal

man ls          # the full manual page (q to quit, / to search)
ls --help       # a shorter summary most commands support
type cd         # is it a program, an alias or a shell builtin?

When a command fails, read the error message. It almost always tells you what went wrong: No such file or directory, Permission denied and command not found are three different problems with three different fixes.

Keyboard shortcuts you will use every day

Keys Effect
Tab complete a file or command name (press twice to see options)
↑ / ↓ move through command history
Ctrl+C stop the running command
Ctrl+L clear the screen (same as clear)
Ctrl+A / Ctrl+E jump to start / end of the line
Ctrl+R search your history as you type

Tab completion is not just a convenience. It prevents typos in long paths, which is the most common beginner mistake.

Practice

Open the Practice Terminal in Dev Tools and try:

  1. whoami and hostname to see who and where you are.
  2. pwd to print the current folder.
  3. man ls, then search for -h by typing /-h.
  4. history to see everything you typed.

Check yourself

  • What does # at the end of a prompt warn you about?
  • In cp -r src backup, which part is the option and which are arguments?
  • Which shortcut stops a command that will not finish?

Tu progreso se guarda solo en este navegador.

Enviar para revisión (10 puntos)