What is a Shell?
A shell is a command interpreter -- the program that reads what you type in the terminal, figures out what you mean, and executes it. When you type ls and press Enter, it is the shell that understands "list the files in the current directory," runs the appropriate program, and displays the result.
The terminal is the window. The shell is the brain inside it.
Shell vs. Terminalโ
This distinction confuses many beginners, so here is a clear breakdown:
| Concept | What It Is | Analogy |
|---|---|---|
| Terminal | The application that displays text and captures keyboard input | A telephone handset |
| Shell | The program that interprets commands and produces output | The person you are talking to |
You can swap out either one independently. You could use a different terminal application (Termux, xfce4-terminal, Alacritty) while keeping the same shell. Or you could switch your shell (from bash to zsh) while using the same terminal.
When you open Termux, it automatically starts a shell inside itself. When you open xfce4-terminal in the XFCE desktop, it also starts a shell. The shell is what makes the terminal useful -- without it, the terminal would just be an empty text window.
Common Shellsโ
Several shells exist for Linux. Each has the same core job -- interpreting commands -- but they differ in features, syntax for advanced operations, and customization options.
| Shell | Full Name | Default In | Character |
|---|---|---|---|
| bash | Bourne Again Shell | Ubuntu, most Linux distros | Reliable, well-documented, universal |
| zsh | Z Shell | macOS (since 2019) | Feature-rich, highly customizable |
| sh | Bourne Shell | Legacy systems | Minimal, scripting standard |
| fish | Friendly Interactive Shell | None by default | User-friendly, colorful, auto-suggestions |
| dash | Debian Almquist Shell | Debian (as /bin/sh) | Fast, minimal, for scripts |
In ADL, you will most likely use bash. It is the default shell in Ubuntu and the most commonly documented shell for Linux. If you follow any Linux tutorial online, it almost certainly assumes you are using bash.
Termux uses bash by default. Ubuntu inside proot also uses bash by default. Unless you deliberately change your shell, you are using bash throughout the ADL stack.
What the Shell Does For Youโ
Beyond simply running commands, the shell provides several features that make your terminal experience productive.
Tab Completionโ
Start typing a command or file name and press the Tab key. The shell will:
- Complete the name if there is only one match
- Show all matches if there are multiple possibilities
For example, type cd Doc and press Tab. If there is a folder called "Documents," the shell completes it to cd Documents.
This saves typing and prevents spelling mistakes. Use Tab constantly -- experienced Linux users press Tab almost as often as the spacebar.
Command Historyโ
The shell remembers every command you type. Press the up arrow to scroll through previous commands. Press the down arrow to go forward.
You can also search your history by pressing Ctrl+R and typing part of a previous command. The shell finds the most recent match.
historyA numbered list of your recently typed commands. You can re-run any command by typing ! followed by its number (for example, !42 runs command number 42 from your history).
Pipesโ
Pipes let you send the output of one command as the input to another. The pipe character is |.
For example, to list files and search for a specific one:
ls -la | grep reportThis runs ls -la (list all files with details), then sends that output to grep report (which filters for lines containing "report"). The result shows only files with "report" in their name.
Pipes are one of the most powerful concepts in the shell. You can chain as many commands as you need:
cat server.log | grep ERROR | sort | uniq -cThis reads a log file, finds all error lines, sorts them, and counts unique errors.
Redirectionโ
You can send command output to a file instead of the screen:
| Operator | What It Does | Example |
|---|---|---|
> | Write output to a file (overwrites) | ls > filelist.txt |
>> | Append output to a file | echo "note" >> notes.txt |
< | Read input from a file | sort < unsorted.txt |
Environment Variablesโ
The shell maintains environment variables -- named values that configure how programs behave. In ADL, important environment variables include:
| Variable | Purpose | Example Value |
|---|---|---|
DISPLAY | Where to show graphical windows | :0 |
PULSE_SERVER | Where to send audio | tcp:127.0.0.1:4713 |
HOME | Your home directory | /home/user |
PATH | Where the shell looks for commands | /usr/bin:/usr/local/bin |
You can see a variable's value with echo:
echo $HOMEAnd set a variable with export:
export MY_VARIABLE=helloWildcardsโ
Wildcards let you match multiple files with a pattern:
| Wildcard | Meaning | Example |
|---|---|---|
* | Matches anything | *.txt matches all text files |
? | Matches one character | file?.txt matches file1.txt, fileA.txt |
[abc] | Matches one of the listed characters | file[123].txt matches file1.txt, file2.txt, file3.txt |
ls *.pdfThis lists all PDF files in the current directory.
Customizing Your Shellโ
Bash reads configuration from a file called .bashrc in your home directory. This file runs every time a new shell starts, so you can use it to:
- Set environment variables
- Create shortcuts (aliases)
- Customize the prompt appearance
- Add directories to your PATH
A common customization is creating aliases -- shortcuts for commands you type frequently:
alias ll='ls -la'
alias update='sudo apt update && sudo apt upgrade'
alias home='cd ~'
After adding these to ~/.bashrc, typing ll does the same thing as ls -la.
Do not edit .bashrc until you are comfortable with basic shell usage. The defaults work well. Once you find yourself typing the same long commands repeatedly, that is the right time to create aliases and customize your configuration.
Summaryโ
A shell is the command interpreter that runs inside your terminal. It reads your commands, executes them, and displays results. Bash is the default shell in both Termux and Ubuntu, and it provides powerful features like tab completion, command history, pipes, redirection, and environment variables. While the terminal is the window you see, the shell is what makes it intelligent and interactive.
Next: Explore the Linux essentials command reference for a comprehensive list of useful commands.