Linux Shell

Linux Shell Definition and Use

  • The Linux shell is a Command Line Interface (CLI) or Text User Interface (TUI) for Linux.

  • Acts as an interface between the user/administrator and the operating system's core (kernel).

  • Main function: Read and parse commands, interacting with the Linux kernel.

  • While most Linux distributions feature a graphical user interface (GUI), many administrative tasks are performed using shell commands.

Linux Shell Access Methods

  • From the Console:

    • Ctrl+Alt+F1: Start first shell session.

    • Ctrl+Alt+F2 through Ctrl+Alt+F6: Switch to additional shell sessions.

  • From a Desktop GUI:

    • Open a terminal session from applications menu.

Linux Shell Types

  • sh (Bourne Shell): The oldest shell, historically used but not common today.

  • Bash (Bourne-Again Shell): Default for most distributions with features like command completion and history.

  • zsh (Z Shell): Enhanced version of Bash with additional features.

  • ksh (Korn Shell): Offers more scripting features; developed by David Korn.

  • csh (C Shell): Syntax similar to C programming language.

  • tcsh: Improved version of C Shell with command line editing features.

Common Commands

  • echo $SHELL: Returns default or preferred shell (set in /etc/passwd).

  • echo $0: Displays the name of the current shell or script.

Shell Characteristics

  • One shell can run within another, either interactively or via programs.

  • Shells utilize configuration files to establish their operating environments.