Automate repetitive and Complex Tasks
It is a command interpreter that provides a line-oriented interactive and non-interactive interface between the user and the operating system. The commands entered by the command line interpreted by the shell and then sent as instructions to the operating system. The command-line interface is accessible from GNOME and KDE through Applications -> Accessories -> Terminal. The commands placed in a script are executed consequently like a program.
Advantages of Using Linux Shell Over Graphical User Interface
- Pattern Matching using wildcard substitution in file names, instead of using the actual file name.
- Background processing: Run the long tasks in the background and freeing the terminal for concurrent interactive processing.
- Command aliasing: To give an alias name to a command or phrase, which get substituted by text which it refers to on command line or in shell script.
- Command history: Records the commands entered in a history file to easily access, modify, and reissue listed command.
- Filename substitution: Automatically produces a list of file names on a command line using pattern-matching characters.
- Input and output redirection: Redirects input away from the keyboard and redirect output to a file or device other than the terminal.
- Piping: Links any number of commands together to form a complex program. The standard output of one program becomes the standard input of the next.
- Shell variable substitution: Stores data in user-defined variables and predefined shell variables.
$ echo $0: shows the name of the shell
$ echo $SHELL: shows the path to the shell
- bash or sh – Bourne shell: The Bourne shell or command, sh is the default on many Linux distributions, making it something of a de-facto standard. Since 1976, it is the basis for most Unix shell scripts because of its ubiquitousness. In 1989, bash emerged from the GNU Project as a newer, more modern version of sh. In 2007, version 3.2, released under the GNU Public License 3.0.
It does not support job control command history.
- csh – C-Shell: Developed for use with BSD Linux, available as an alternative shell along with Korn and Bourne shells. The command-line editing and history first developed in C-shell, which allows a few line command editing.
It is accessed with the command csh, as a link to TCSH. The prompt for it is %.
- tsch – An enhanced version of C-shell used in BSD versions. Fully compatible essential version of C-shell and it incorporates all its capabilities like shell language and history utility. It includes advanced command-line and history editing features. It supports automatic command line and filename completion, shell native language, extensive terminal management, new built-in commands, and system variables.
- ksh – Korn shell
- Z-shell: An interactive UNIX login shell and as a command interpreter for shell scripting. It is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh.
zsh is licensed under a variant of the less-restrictive MIT license. Its features include: built-in spell-check, supports plugins, menu autocomplete.
- fish: It is user-friendly and comes with predictive typing, syntax highlighting, searchable command history, and auto-suggestions.
- # for root, admin, administrator, supervisor or superuser having unrestricted access to every area of the system and its configuration
- $ regular user
To view default shell, execute the command
echo $SHELL /bin/bash
The shell allows a user to create simple batch scripts or Power shell scripts to automate certain processes.
According to MacNN the latest developer release of Apple Mac OS X “Panther” has changed its default shell from tcsh to bash. macOS built on top of Unix offers a robust command-line environment that provides a non-interactive shell to write scripts that automate actions. Since Mac OS X 10.3 Panther, Mac’s default shell is the Bourne-again shell or Bash.