In Linux & Unix-like operating systems, a shell is a command-line interpreter that acts as an intermediary between the user & the operating system. It provides an interface for users to interact with the system by executing commands, running programs, & performing various tasks through a text-based interface.
When you type a command into a shell prompt & press Enter, the shell interprets that command, executes it, & displays the output. Additionally, shells offer features such as command history, tab completion, & scripting capabilities, enabling users to perform tasks efficiently.
UNIX, Linux, Mac OS
- sh (Bourne Shell), ksh (Korn Shell), csh (C Shell), zsh (Z Shell) & many more.
- Bash (Bourne Again Shell) is most popular.
- Zsh is default on Mac.
Windows
- CMD, PowerShell.
- Linux subsystem runs bash/zsh.
- Zsh is known for its highly interactive use & provides advanced features for command-line editing & customization.
- It is highly extensible & supports plugins & themes through frameworks like Oh My Zsh, which make it easy to customize & enhance.
The shebang, also known as a hashbang, is a special character sequence at the beginning of a script file in Unix-like operating systems. It is used to specify the interpreter that should be used to execute the script.
The shebang consists of the characters #!
followed by the path to the interpreter executable. For shell scripts, the shebang typically specifies the path to the shell interpreter, such as Bash or sh.