EMZETT.
Login

Shell

In short: A program that provides a text-based command line for controlling the operating system.

In more detail: Takes in commands (displaying files, starting programs, running scripts) and passes them on to the operating system. Well-known examples: Bash/Zsh on Linux/macOS, CMD and PowerShell on Windows. The Secure Shell (SSH) allows encrypted remote access to another machine’s shell.

In Depth

Shell as an interface, not the kernel

Strictly speaking, a shell is just ONE possible interface to the operating-system kernel — the actual “core” (process management, memory, file system) stays the same, regardless of whether it’s controlled via a graphical interface or a shell. The name “shell” expresses exactly this: it wraps the kernel and translates human-readable commands into system calls, without itself being part of the kernel — a shell can crash and restart without the system itself being affected.

Interactive vs. script-driven

A shell can be used in two ways: interactively (enter a command, see the result, enter the next command) or as an interpreter for scripts (processing an entire file of commands in one go). The central advantage over graphical operation is scriptability: a sequence of commands can be written into a file (script) and run automatically, as often as you like, exactly identically — a click path through several GUI menus, by contrast, can hardly be reliably automated or checked into version control.

Pipes and composition

A central concept of many shells, especially pronounced in Unix shells, is the pipe (|): the output of one command becomes directly the input of the next:

cat access.log | grep "ERROR" | wc -l

This example counts how many lines of a log file contain the text “ERROR” — three tiny, individually simple commands (output a file, filter, count lines) are combined into a complex analysis. This “combine small tools” philosophy is a basic principle of Unix design philosophy and makes shells so powerful, even though the individual commands each stay simple.

Differences between shells

Unix-like shells (Bash, Zsh, Fish) and Windows shells (CMD, PowerShell) differ considerably in syntax and capabilities. CMD is functionally more limited and only passes text between commands. PowerShell works with structured .NET objects instead of plain text. Bash/Zsh offer a rich command language, grown over decades, with pipes, redirections (>, >>, 2>) and control structures — Zsh (the default shell on macOS since 2019) extends Bash with convenience features like better autocompletion, while remaining largely compatible with Bash scripts.

See also: Command Line, Secure Shell, Bash, CMD