You might have heard the terms
shell and asked yourself: Isn’t this all the same? Here is some more info…
terminal- user interface for input, output and some extra tasks
tty- a device file, that implements additional commands beyond read and write
console- a physical or kernel implemented (
prompt- interface, where the user types a single command and hits
shell- an executable programm providing a user interface, that interprets and executes input or scripts
#!/bin/shin a script tells you this file should be interpreted by
- The POSIX shell spec lists the things these interpreters MUST understand to be compliant
zshare supersets of
shand therefore POSIX compliant, shells like
/bin/shis not an executable, but a symlink to
/bin/bashor others, which might not always be a good thing .
- Always try to make your scripts
/bin/shcompliant, so they just work
dashrun scripts faster than
bash, but never to
fishor other NON-POSIX compliant shells
- Improve the default shell configuration
terminal once was an electronic device (e.g.
VT100) for input and output of text content. Today it is also a short form for
terminal emulator, which is a piece of software, that emulates this hardware device in a graphical user interface.
This means, a
terminal is responsible for the following “features”:
- Input: shortcuts, entering text, copy & paste, etc.
- Output: rendering, colors, fonts, unicode, etc.
- Extras: clipboard management, etc
So basically everything that has to do with the look & feel, rendering as well as the integration with your operating system, is your
terminal. If it does not support colors or unicode characters, it will not display these correctly.
Setting up a
terminal with modern features should be the first step before using the command line. Most POSIX compatible operating systems already have an acceptable
terminal preinstalled, but you might want to check out these alternatives:
- Alacritty - A fast, cross-platform, OpenGL terminal emulator
- ST - a simple but modern terminal implementation for X
- urxvt - a fork of the well known terminal emulator rxvt with unicode support
- Konsole - KDE’s Terminal Emulator
console is a physical
terminal. It appears to the operating system as a (kernel-implemented) terminal. On Linux and FreeBSD, it shows up as several terminals (ttys) with the ability to switch between them with keyboard shortcuts. So there is no big difference to a terminal apart from that, even names like
virtual terminal and other variations basically mean the same thing.
A shell is basically a command line interpreter. Most shells also provide an interactive prompt to execute commands. Its primary purpose is to start other programs. The POSIX shell spec lists the things these interpreters MUST understand to be compliant, but not all shells follow this specs.
dash- a modern POSIX-compliant implementation of sh (also Bourne shell,
bash- a POSIX-compliant implementation with many simplifying extensions
zsh- a superset of bash
fish- Unix shell with a focus on interactivity and usability, designed to give the user features by default, rather than by configuration
dash is interesting, because it implements the POSIX shell spec
with only a minor set of extensions. This leads to the following advantages:
- Performance - roughly 4x times faster than
- Low resource usage (disk space, RAM and CPU)
- Improved security (long-established, tiny, simple, many active developers)
bash is interesting, because it is the de facto standard on many distributions. It contains many extensions that simplify shell usage but also make it slower than shells with fewer extensions.
zsh is often cited as superset of bash. It contains even more extensions and improvements, merging some features from other shells like
fish is a shell with a focus on usability. What’s interesting about it, is, that it is NOT POSIX shell spec
compliant, which means, that it SHOULD NOT be linked to
/bin/sh as default shell, because it may break many scripts, especially system scripts made for
/bin/sh. This may be the reason, why
fish is often a controversial topic: Many people like it, but many don’t.
Most shells can be configured using a
.*rc variable in home directory, but the defaults are often not very handy or beautiful. Maybe its worth taking the time to configure your shell having the following features:
- Custom alias configs
- A beautiful themed prompt (e.g. take a look at https://github.com/romkatv/powerlevel10k for
Take in mind that some of these improvements may slow down shell performance, but if you choose wisely, this should not be a concern.