Linux online course

The Linux Shell: Purpose and Common Shells

Learn what a Linux shell is, how it differs from the kernel and GUI, what command-line tasks it supports, and how Bash, C shell, and Korn shell compare.

What Is a Linux Shell?

A shell is a program that provides a Command-Line Interface (CLI) for communicating with an operating system. In a CLI, you type text commands instead of selecting items in windows, menus, or icons.

The shell receives commands entered by the user, interprets them, and asks the operating system to carry out the requested work. For example, a command can start a program, display files in a directory, or read and modify a text file.

The shell is not the Linux operating system's core. It is a user-facing command interpreter that works with the Linux kernel. The kernel is the core part of the operating system responsible for managing resources such as the processor, memory, devices, and running processes.

The Shell, Kernel, and GUI

Linux users commonly interact with a system through either a shell or a graphical user interface. These are different ways to request work from the operating system.

ComponentRoleHow the User Interacts With It
ShellInterprets text commands and starts programs or operations.The user types commands at a prompt.
KernelManages core system resources, hardware access, memory, and processes.The user normally interacts with it indirectly through the shell or other software.
GUIProvides a visual desktop using windows, icons, menus, and pointers.The user clicks, selects, drags, and enters information in graphical applications.

A Graphical User Interface (GUI) is often easier for visually exploring a system. A shell, however, makes commands precise, repeatable, and easy to combine. Many Linux administration tasks, troubleshooting procedures, and learning exercises are documented as shell commands even when the computer also has a graphical desktop.

What Can You Do in a Shell?

The shell is a working environment for entering and running commands. Typical activities include:

  • Launching programs and utilities.
  • Navigating directories in the file system.
  • Creating, copying, moving, renaming, and deleting files and directories.
  • Reading, searching, and manipulating text files.
  • Combining commands to create repeatable workflows.
  • Managing processes and performing system administration tasks.

For example, a user might move to a directory, list its contents, and search a text file. These operations are performed by commands launched through the shell. The shell itself interprets the command line and usually starts the appropriate program to perform the operation.

Linux distributions normally include a GUI option, but command-line knowledge remains useful because it works well over remote connections, can operate efficiently with many files, and exposes system concepts that graphical tools may hide.

A Bash Shell Session

Bash is the shell most commonly encountered as the default shell on Linux systems. Its name is short for Bourne Again Shell. A typical Ubuntu terminal may show a prompt similar to this:

student@ubuntu:~$ pwd
/home/student
student@ubuntu:~$ ls
Documents Downloads notes.txt
student@ubuntu:~$

In this example, the text ending in $ is the shell prompt. It indicates that Bash is ready to accept a command. The user enters pwd, Bash runs the command, and the command prints the current directory. The user then enters ls, which lists items in that directory.

The prompt can vary between systems. A real prompt may include a different username, computer name, directory, or prompt character. The example represents a user who has logged in to an Ubuntu system and is interacting with Bash through a terminal.

Common Linux and UNIX Shells

Linux supports multiple shells. They can provide different command syntax, interactive features, and scripting conventions. A command or script written for one shell may not behave identically in another shell, so identifying the intended shell matters when following instructions.

ShellFull Name or DescriptionNotable Context
BashBourne Again ShellA widely used and commonly default Linux shell.
C shellA shell with an interface associated with the C programming language.Its command and scripting style has similarities to C-language syntax.
Korn shellA UNIX shell, commonly called Korn shell or ksh.Historically popular among UNIX System V users.

Bash

Bash is the most familiar shell for many Linux users. It supports interactive command entry, command history, variables, pipelines, redirection, and shell scripts. Its widespread use means that many Linux tutorials and examples use Bash syntax.

C Shell

The C shell, commonly associated with csh, has an interface and scripting style with similarities to the C programming language. It is one of the shells a user may encounter when working with older UNIX environments or software that expects C shell conventions.

Korn Shell

The Korn shell, commonly associated with ksh, is a UNIX shell that became popular among UNIX System V users. UNIX System V is a UNIX family context in which the Korn shell was widely used.

CLI Versus GUI

A CLI presents a text prompt. The user types a command, presses Enter, and reads text output. A GUI presents visual controls such as windows, icons, menus, and pointers. The user usually selects an action by clicking or using touch and keyboard controls.

Neither interface makes the other useless. A GUI can make everyday desktop tasks approachable, while a CLI can make advanced operations more transparent and efficient. Linux administrators often use shells to connect to remote systems, inspect logs, automate repeated tasks, and work without a full desktop environment.

Windows Command Prompt is a familiar example of a command-line shell on a non-Linux operating system. The general idea is similar: the user types commands and receives text output. The exact commands and scripting rules differ between operating systems and shells.

Shell and Kernel: A Simple Request Path

When you enter a command, the shell does not replace the kernel. Instead, it interprets the command and starts the required program or requests the relevant operating-system service. The kernel then manages the underlying resources needed by that work.

  1. The user types a command at the shell prompt.
  2. The shell parses the command and its arguments.
  3. The shell launches a program or performs a shell operation.
  4. The program communicates with the kernel when it needs files, memory, devices, or other system resources.
  5. The result is displayed in the terminal, and the shell presents another prompt.

This separation explains why the shell can be replaced without replacing the Linux kernel. Different shells can provide different user experiences while relying on the same underlying operating-system core.

Key Points to Remember

  • A shell is a program that provides a text-based command-line interface.
  • The shell interprets user commands; the kernel manages core system resources.
  • A CLI uses typed commands, while a GUI uses visual controls.
  • Shells can launch programs, navigate and manage files, and work with text.
  • Bash means Bourne Again Shell and is a common default Linux shell.
  • The C shell has a C-like interface, while the Korn shell was historically popular among UNIX System V users.
  • Different shells may use different syntax and scripting conventions.

Related Linux Topics

To continue practicing command-line work, explore Bourne Again Shell Bash, learn about the Linux file structure, and practice searching for text strings with grep.