How to Use the Linux Shell

Shells offer a text-focused entry point into your Linux system

Consumer-grade Linux distributions offer powerful graphical user interfaces — yet Linux, because it originates in the 1970s-era Unix world, still runs on an architecture that doesn't rely on a specific GUI.

A text-based entry point into the system is called a shell, and Linux supports several of them.

linux shells

What Is a Shell?

A shell is a text-based method of interacting with a computer's operating system — a function called a command interpreter. Shells use their own syntax and logic; they function as intermediaries between a logged-in user and the computer kernel, executing other programs like system utilities or user-installed applications.

Linux supports several different shells:

  • Bash: Bash is the default shell on most modern Linux distributions. It's optimized for interactive use through command histories, command-line editing, command aliasing, and basic job control.
  • Fish: Designed to be more user-accessible, Fish emphasizes command completions, user scripts, and advanced terminal features. It's optimized for interactive use.
  • Ksh: Korn shell is a high-level programming language in its own right, although it's interactive support is excellent.
  • Zsh: Great for power users, Zsh offers advanced scripting features and a significant amount of customizability. It supports various indices, as well.

Nothing precludes you from installing as many different shells as you like. Although only one will serve as default, you're free to invoke a shell within a shell within a shell. To see which shells are already installed for your distribution, run cat /etc/shells.

Shells aren't the same thing as a terminal. Terminals are the graphical programs within which a shell session operates. Generally, you need a terminal to run a shell session, but the shell session and the terminal aren't linked. That is, the same terminal program runs any shell, and any shell runs in any terminal program.

Both Microsoft Windows and Apple macOS include shells, too. In Windows, the shell is called Command Prompt, although new versions of Windows support PowerShell. In macOS, the Terminal program opens a shell session. In Linux, although some sloppy writers refer to shell sessions as a "command prompt," Command Prompt is specific to Microsoft.

Why Use a Shell Session?

Straightforward home-desktop Linux fans rarely need to use a shell session, because modern Linux offers robust GUI control panels. Almost all normal desktop-class tweaks may be completed within the GUI.

However, because Linux supports many different distributions and more than a dozen different desktop environments, even basic advice about how to perform a task in Linux gets confusing in a hurry. Unless your instructions are focused on your desktop environment, the step-by-step procedures will differ — often significantly. For that reason, much of the how-to or troubleshooting advice for Linux emphasizes shell commands.

For example, to see what programs presently run on your Linux computer, the process in the GUI differs by distribution. On Ubuntu 20.04, you'd open the Launcher and select System Monitor whereas on openSuse Tumbleweed, you'd launch KSysGuard from the K Menu's System folder. And for each GUI tool, the appearance and functionality differs, necessitating different step-by-step instructions and, as necessary, screenshots. However, for either distribution, simply running ps -ax from a shell session gives the same output in the same way.

How to Use a Linux Shell

Thriving in a text-only universe isn't too hard. In fact, many hardcore Linux fans practically live in the shell. To get started, run your distribution's terminal program or its equivalent. When the window opens, you'll be at a fresh shell session.

When you're done, use the exit command or close the terminal program.

Each shell offers different features, although common Linux utilities (like the cd command to change directories or the cat command to display files) work the same way in all shells. Study your shell's unique syntax to master its power.