Chapter 1 · Lesson 1
Beginner
2 min read
Terminal, Shell and Prompt
Overview
The terminal is a window that displays text and accepts keyboard input. The shell reads that input and decides which program to run. Bash is a common Linux shell, but the same principles apply to Zsh and other shells.
Detailed Notes
What happens when you type a command
Suppose you type:
bash
echo Hello Linux
The shell separates the text into words:
echois the program to run.Hellois argument 1.Linuxis argument 2.
The echo program joins its arguments and writes Hello Linux to standard output.
The prompt identifies a waiting shell. A common prompt looks like:
text
learner@ubuntu:~$
learneris the user.ubuntuis the computer name.~means the user's home directory.$indicates a normal user.#often indicates root.
Built-in help
bash
echo "$SHELL"
type ls
ls --help
man ls
echo "$SHELL"prints the configured login shell.type lsshows whetherlsis a program or shell alias/builtin.ls --helpprints a short option summary.man lsopens the full manual page. Pressqto quit.
Useful keyboard behavior
bash
pwd
- Press
Tabonce to complete a filename or command. - Press
Tabtwice to list alternatives. - Press
Ctrl+Lto clear the visible terminal. - Press
Up Arrowto recall the previous command. - Press
Ctrl+Cto interrupt a running foreground process. - Press
Ctrl+Dto send end-of-input or close the shell.
Practice
- Print your shell.
- Run
pwd. - Type
ech, pressTaband finish the command. - Open
man pwd, read a few lines and quit.
The terminal receives text, while the shell finds and starts the requested program.
Common Interview Questions
Finished this lesson?
0 of 25 lessons done · 0% of the course

