Shell
lastmod 2026-09-04created 2020-08-2624 edits
A shell (North Korean standard language: swel, or jaryeong haeseok peurogeuraem, "command-interpreting program") is a program that provides an interface for accessing various operating system functions and services. It is called a shell (the English word for an outer casing) because it is the layer wrapping the interface between the user and the internals of the operating system (the kernel).
Shells are generally classified into two kinds: command-line and graphical. A command-line shell provides a command-line interface (CLI) to the operating system, while a graphical shell provides a graphical user interface (GUI).
The relative merits of CLI- and GUI-based shells are much debated. CLI proponents argue that common tasks (such as moving files) can be done much faster in a CLI shell. GUI proponents, in contrast, point to the relative usability and simplicity of GUI shells. In general, servers, where performance matters and skilled administrators do most of the work, mostly use a CLI, while computers used for everyday work mostly use a GUI.
Categories
- Shell:Basic - Shell basics.
- Shell:Hooks
- Here document - Passes a string to stdin in a form like
<< EOF. - atuin - Stores shell history in SQLite
- Dagger Shell - A new shell for the container era
- Starship - A small, fast, customizable prompt for any shell
- Vet - A tool for running remote shell scripts more safely
- VHS - Your CLI home video recorder 📼
Overview
A system program that sits between the kernel and the user in an operating system, interprets the user's commands, and displays the results. The term comes from the dictionary meaning of shell, a clam or conch shell: the kernel is inside, and the user reaches the kernel through the shell wrapped around it. The word has been used since the early days of computing in the 1960s.
Shells are commonly divided into two kinds: command-line shells and graphical shells. The former is called a CLI and the latter a GUI. A CLI is sometimes also called a CUI (character or console user interface).
The term also refers to the secure access program used to connect to this environment (SSH; Secure SHell).
Checking installed shells
Changing the current user's default shell
See chsh for details.
Command-line shell
- Unix shells:
- Bourne shell (sh)
- Almquist shell (ash)
- Bash
- Bourne shell (sh)
- TENEX C shell (tcsh)
Graphical shells
- Microsoft Windows environment:
- Windows Explorer
- LiteStep
- GeoShell
- BB4Win
- Emerge Desktop
Sehll shortcuts
Basic shortcuts and features that work in almost every shell:
- The CTRL + W, U, K, Y combinations are line-editing shortcuts that quickly delete or restore the word or line before or after the cursor
- CTRL + W deletes the word before the cursor
- CTRL + U cuts from the cursor to the start of the line; CTRL + Y pastes it back
- CTRL + K cuts from the cursor to the end of the line
- CTRL + A / E move to the start and end of the line; ALT + B / F move backward and forward by word
- Enabled by default in most terminals; on Mac, the Option key must be set as Meta for it to work
- The reset or stty sane command recovers a terminal broken by accidentally printing a binary file
- Input still works even if the screen is garbled, so type reset and press Enter to restore it
- CTRL + C / D send an interrupt and an EOF (end of file) signal respectively
- CTRL + D on an empty prompt exits the shell
- CTRL + L clears the screen immediately, same as the clear command
- Moves the prompt to the top of the screen while keeping the command being typed
- cd - jumps straight to the previous directory; pushd / popd let you move between several locations using a directory stack
- > file.txt empties the file without deleting it, preserving permissions and ownership
- The $_ variable reuses the last argument of the previous command
- Example: mkdir -p /path/newdir && cd "$_"
- set -e and set -u are options that make scripts safer
- set -e exits immediately on error
- set -u treats references to undefined variables as errors
- The set -euo pipefail combination provides stronger protection
Advanced shortcuts and features in Bash and Zsh
- CTRL + R performs a reverse incremental search through command history
- Typing a keyword instantly finds a past command to reuse
- sudo !! reruns the last command with administrator privileges
- Requires extra configuration in Zsh
- The fc command is the traditional way to open the previous command in $EDITOR for editing
- Pressing it repeatedly cycles through arguments of earlier commands
- !$ does the same non-interactively
Troubleshooting
Unicode characters like ë are suddenly typed
See Terminal emulator#How to enter Unicode characters on Linux.
Unicode characters like e̲ are suddenly typed
See Emoji#Emoji insertion mode.
Favorite site
Tutorials
- [Recommended] Welcome to Linux command line for you and me! — Linux command line for you and me 0.1 documentation
- Atuin
- Bash
- Bourne shell
- Chsh
- Command Prompt
- Computer Language
- Dagger Shell
- Environment variable
- Exec
- Exit status
- GSH
- Here document
- History
- IntelliShell
- Murex
- Pytest-cov
- Python:shlex
- Remote Shell
- Secure Shell
- Shebang
- Shell Script
- Shell:Basic
- Shell:Hooks
- Shellcheck
- Terminal emulator
- Trac:HowToInstall
- Vet
- Windows PowerShell
- Windows shell
- Z shell