What is sh
Last updated: April 1, 2026
Key Facts
- The original shell (Bourne shell or sh) was developed by Stephen Bourne at Bell Labs in 1977 and became the standard for Version 7 Unix systems
- The shell reads user input, interprets commands, locates programs, manages input and output, and controls process flow in operating systems
- Modern shells like bash (Bourne Again Shell), zsh, and ksh are derivatives or extensions of the original sh that maintain compatibility with its core command structure
- Shell scripting enables users to create automated programs by writing sequences of commands in text files, useful for system administration and routine tasks
- Environment variables managed by the shell store system configuration settings and user preferences that programs can access and utilize during execution
Understanding the Shell
Sh, commonly known as the shell or Bourne shell, is a command-line interpreter and programming language interface for Unix and Unix-like operating systems. It serves as the text-based interface between users and the operating system, allowing users to interact with computers through typed commands rather than graphical menus. The shell reads user input, interprets commands, locates and executes programs, manages input and output, and handles the overall flow of system operations. As a foundational component of Unix systems, the shell has been instrumental in shaping how computer users and administrators interact with systems since its development in the 1970s.
History and Development
The original shell, known as the Bourne shell or "sh," was developed by Stephen Bourne at Bell Labs in 1977 as part of Version 7 Unix. It became the standard shell for early Unix systems and established many conventions still used today. The Bourne shell provided the first practical implementation of shell scripting, allowing users to write programs composed of shell commands saved in text files for automated execution. Since its creation, numerous shells have been developed, each building upon or extending the concepts established by the original shell. The shell's influence extends beyond Unix to modern operating systems like Linux and macOS, where shell interpreters remain essential tools for system administration and advanced computing tasks.
Shell Functions and Capabilities
The shell performs several critical functions in computer systems:
- Command Interpretation: Reads and executes user commands, translating them into system operations
- Program Execution: Locates and runs executable programs and utilities available on the system
- File Management: Provides commands for navigating directories, managing files, and organizing the file system
- Input/Output Redirection: Allows users to redirect command output to files or chain commands together using pipes
- Environment Variable Management: Stores and manages system configuration settings that programs can access and use
- Process Control: Manages running processes, allowing users to run programs in the background or foreground
Modern Shell Variants
While the original sh (Bourne shell) established the foundation, modern Unix systems use improved variants. Bash (Bourne Again Shell), developed by Brian Fox and maintained by Chet Ramsey, became the most widely used shell, extending the Bourne shell with additional features and improved usability. Bash is the default shell on most Linux distributions and macOS systems. Other popular shells include Zsh (Z shell), which offers enhanced interactive features and customization options; Ksh (Korn shell), which combines features from both Bourne and C shells; and Fish (Friendly Interactive Shell), which prioritizes user-friendliness for interactive use. Despite these variants, all modern shells maintain compatibility with or derive from the original shell's command structure and scripting capabilities.
Shell Scripting
Shell scripting is a powerful capability that allows users to create automated programs using shell commands. A shell script is simply a text file containing a sequence of shell commands that the shell executes sequentially. Shell scripts are commonly used for system administration tasks, backup operations, log file processing, and routine maintenance. Scripts can include variables, control structures (if statements, loops), and functions, making them a complete programming language suitable for many computing tasks. The simplicity and power of shell scripting have contributed to the shell's continued importance in modern computing environments, even as graphical interfaces have become prevalent.
Environmental Variables and Configuration
The shell manages environment variables—named settings that store information about the system configuration, user preferences, and program settings. Common environment variables include PATH (which specifies where the shell searches for executable programs), HOME (the user's home directory), and USER (the current username). Users can customize their shell experience by modifying configuration files such as .bashrc or .zshrc, which contain settings and commands executed when the shell starts. This customization capability allows each user to tailor their shell environment to their preferences and workflow requirements.
Related Questions
What is the difference between sh and bash?
Bash (Bourne Again Shell) is an extended version of sh that includes additional features like command history, programmable completion, and improved scripting capabilities. While sh is more minimal and portable, bash is more feature-rich and user-friendly, becoming the default shell on most Linux systems.
How do you write a shell script?
Shell scripts are text files containing shell commands, starting with a shebang line (#!/bin/sh or #!/bin/bash) indicating the shell to use. Write commands sequentially in the file, make it executable with chmod +x, and run it. Scripts can include variables, loops, and conditionals for complex automation.
What are environment variables in the shell?
Environment variables are named settings storing system configuration and user preferences that programs can access. Common examples include PATH (program search locations), HOME (user directory), and USER (username). Users can view variables with 'env' or 'echo $VARIABLE' and set them in shell configuration files.
More What Is in Daily Life
- What Is a Credit ScoreA credit score is a three-digit number, typically ranging from 300 to 850, that represents your cred…
- What Is CD rates make no sense based on length of time invested. Explain like I'm 5CD (Certificate of Deposit) rates often don't increase with longer lock-up times the way people expe…
- What is a phdA PhD (Doctor of Philosophy) is a doctoral degree earned after completing advanced academic research…
- What is a polymathA polymath is a person with deep knowledge and expertise across multiple different fields or academi…
- What is aaveAAVE stands for African American Vernacular English, a dialect with distinct grammar, pronunciation,…
- What is aarch64ARMv8-A (commonly called ARM64 or AArch64) is a 64-bit processor architecture developed by ARM Holdi…
- What is about menTopics and discussions about men typically encompass masculinity, male identity, gender roles, men's…
- What is abiturAbitur is the German academic qualification awarded upon completion of secondary education, typicall…
- What is abrosexualAbrosexual is a sexual orientation identity where a person's sexual attraction changes or fluctuates…
- What is abgABG is an Indonesian acronym standing for 'Anak Baru Gede,' which refers to adolescent girls or teen…
- What is aaaAAA batteries are a standard cylindrical battery size measuring 10.5mm in diameter and 44.5mm in len…
- What is aacAAC (Advanced Audio Codec) is a digital audio compression format that provides better sound quality …
- What is aaa gameAAA games are high-budget video games developed by large studios with budgets typically exceeding $1…
- What is a proxyA proxy is a server that acts as an intermediary between your device and the internet, forwarding yo…
- What is ableismAbleism is discrimination and prejudice against people with disabilities based on the assumption tha…
- What is absAbs, short for abdominal muscles, are the muscles in your core that flex your spine and stabilize yo…
- What is abortionAbortion is a medical procedure that ends pregnancy by removing the fetus before viability. It can b…
- What is accutaneAccutane (isotretinoin) is a powerful prescription medication derived from vitamin A used to treat s…
- What is acetaminophenAcetaminophen, also known as paracetamol, is an over-the-counter pain reliever and fever reducer use…
- What is acidAcid is a chemical substance that donates protons (hydrogen ions) to other substances, characterized…
Also in Daily Life
- How To Save Money
- Why are so many white supremacist and right wings grifters not white
- Does "I'm 20 out" mean youre 20 minutes away from where you left, or youre 20 minutes away from your destination
- Why are so many men convinced that they are ugly
- What does awol mean
- What does asl mean
- What does ad mean
- What does asap mean
- What does apex mean
- What does asmr stand for
- What does atp mean
- What causes autism
- What does abg mean
- What does am and pm mean
- What does a fox sound like
More "What Is" Questions
Trending on WhatAnswer
Browse by Topic
Browse by Question Type
Sources
- Wikipedia - Unix Shell CC-BY-SA-4.0
- Wikipedia - Bourne Shell CC-BY-SA-4.0