Glossary Development

Shell

A shell is a program that reads commands you type, runs them and shows the results, forming the text interface to an operating system.

Last reviewed:

AdSense Placeholder
Slot: header_reference_page

In more detail

A shell reads a line you type, splits it into a command and arguments, runs the program and prints what it returns. Common shells are Bash and Zsh on Linux and macOS, and PowerShell and Command Prompt on Windows. Shells can chain commands with pipes (|), expand patterns such as *.txt, use variables and run scripts. Every command ends with an exit status: 0 means success and anything else means an error. The window that hosts a shell is the terminal. See Linux Command Line Cheat Sheet.

Why it matters

The shell is the common language of servers, build systems and incident response, so a small vocabulary goes a long way. It also needs care: the shell expands wildcards and special characters before the program sees them, and pasting a command you do not understand, especially one containing sudo or rm, can change or delete data with no undo.

Example

In a folder holding one.txt, two.txt and three.log:

$ ls | wc -l
3
$ ls *.txt > list.txt
$ cat list.txt
one.txt
two.txt
$ ls nothing
ls: cannot access 'nothing': No such file or directory
$ echo $?
2

The pipe sends the output of ls to wc -l, which counts lines. > writes output to a file, and $? shows the last exit status.

Common confusion

The shell is not the terminal. The terminal is the window; the shell is the program inside it. It is also not the operating system's kernel, only a program that asks it to do things.

AdSense Placeholder
Slot: footer_leaderboard