What the Shell Is and Why It Matters
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 areroot, 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:
whoamiandhostnameto see who and where you are.pwdto print the current folder.man ls, then search for-hby typing/-h.historyto 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?
يُحفظ تقدّمك في هذا المتصفح فقط.
إرسال للمراجعة (10 نقطة)