Terminal #
Using a terminal can be necessary during development, in order to execute a program that does not have a graphical user interface (GUI).
But even when a GUI is available, a Command Line Interface (CLI) can still be the preferred way to interact with some programs. Possible benefits are:
- efficiency (thanks to autocompletion, there is very little to type),
- automation (via scripting),
- more transparency (a GUI may add a layer of obfuscation),
- stability over time (GUIs tend to change from one version of a program to another),
- a wider range of available actions (a GUI may allow you to execute a limited set of commands only),
- reproducibility (the same command performs the same action, with a limited reliance on memory),
- customizability.
Shell #
A shell interprets command typed in a terminal. It can also interpret programs (usually called scripts).
on Linux #
The default shell on most Linux distributions is bash.
on macOS #
The default shell on macOS is zsh. It extends bash with modern features (notably customization options, via plugins).
on Windows #
Windows comes with two shells by default:
- a (mostly) legacy shell called Command Prompt,
- a more modern shell called Windows PowerShell.
Warning. PowerShell is a closely related (cross-platform) shell developed by Microsoft. It is not fully compatible with Windows PowerShell (they are currently meant to “coexist”).
Other shells are commonly used by Windows developers that offer a (possibly partial) Linux-like shell experience. Popular options include:
- git bash (often used to learn git),
- Cygwin,
- WSL, whose latest version runs a full (Arch) Linux virtual machine.
Autocompletion #
Modern shells provide at least two types of command autocompletion:
- completion based on your command history, and
- smart completion (a.k.a. “Tab-completion”) for possible arguments, paths, etc.
As a result, using a terminal requires very little typing.
By default, autocompletion may not be activated (or installed) on your machine. We will see how to do it during the first lab.