Linux shells are an essential part of the Linux operating system. They are command-line interpreters that allow users to interact with the operating system in many ways such as interpreting a user’s command and script files along with telling the OS what to do with them. There are many different types of shells available for Linux, but some of the most popular ones include bash, zsh, and ksh.
Some of the characteristics of the Linux shell include:
- Background processing: Sets up lengthy tasks to run in the background.
- Command aliasing: Gives an alias name to a command or phrase.
- Command history: Records the commands you enter in a history.
- Input and output redirection: Redirects input and output to and from files.
- Shell variable substitution: Stores data in user-defined variables.
- Shell commands: cd, ls, echo, pwd, touch etc.
- Control flow: if…then…else, case and shell loops etc.
Bourne Shell (sh)
Bourne shell is a command-line interpreter for Unix-like operating systems. It was developed by Stephen Bourne at Bell Labs in the 1970s and became the standard shell for Unix Version 7. Bourne shell supports variables, control structures, built-in commands, and basic scripting features. It is also the ancestor of many other shells, such as bash, ksh, and zsh.
Bourne Again Shell (bash)
Bash is a command-line interpreter that allows users to interact with the operating system using text commands. Bash stands for Bourne-Again SHell, a pun on the name of the original Unix shell, the Bourne shell. Bash is compatible with the syntax and features of the Bourne shell, but also adds many enhancements.
Some of the advantages of using bash are:
- Bash is widely available and installed by default on most Linux and macOS systems.
- Bash supports scripting which allows users to write programs that automate tasks and run them in bash.
- Bash offers many built-in commands and utilities that perform common operations such as file manipulation, text processing, arithmetic, and networking.
- Bash provides users the ability to customize their environment using variables, aliases, functions, and options.
- Bash also supports features that make the command-line more user-friendly, such as command completion, history, editing, and redirection.
Z Shell (zsh)
Zsh is a powerful and versatile shell that offers many advantages over the traditional bash. Zsh has features such as auto-completion, spelling correction, globbing, history manipulation, and command-line editing. Zsh can also be customized with themes, plugins, and options to suit different preferences and workflows. The shell is compatible with most Unix-like operating systems and can run scripts written for bash or other shells while also being used by developers, system administrators, and power users.
Some of the features of Z Shell are:
- Programmable command-line completion
- Extended file globbing
- Improved variable/array handling
- Spelling correction and approximate completion
KornShell is a Unix shell that was developed by David Korn at Bell Labs in the early 1980s. It is compatible with the Bourne shell, but also provides many features from the C shell and other advanced shells. KornShell can be used as an interactive command-line interpreter or as a scripting language.
Some of the features of KornShell are:
- Command-line editing and history
- Aliases and functions
- Arrays and associative arrays
- Arithmetic and string operations
- Pattern matching and file name generation
How to Determine Which Shell is Being Used?
In your Linux server, within the current command-line interface, type the command below to view which Linux shell you are using.