A shell is a program that acts as an interface between the user and the operating system, allowing you to interact with the system through text-based commands. It interprets and executes the commands you type, managing system tasks such as file manipulation, process control, and running applications.
Windows, macOS, and Linux operating systems come with built-in shells. Windows uses Command Prompt (cmd.exe) and PowerShell, macOS uses Zsh and Linux distributions use various shells like Bash, Zsh, and Fish.
A terminal emulator is a program that allows you to interact with the shell. It provides a graphical interface to the shell, allowing you to type commands and view the output.
At the time of writing, PowerShell 7 is the latest version of PowerShell and is cross-platform, available for Windows, macOS, and Linux. It provides a more modern and powerful scripting environment compared to the older Windows Command Prompt and PowerShell 5.1.
To install PowerShell 7 on Windows, please refer to the official Documentation. We recommand using cli, i.e. winget, to install PowerShell 7.
winget install Microsoft.PowerShell
macOS comes with Zsh, its default state is sufficient for most users. As for Linux, we mostly use Ubuntu, Debian and their derivatives at Raccoon. The default shell is Bash, which is sufficient for most users.
If you want to customize your shell, you can install Oh My Zsh, a popular framework for managing Zsh configurations.
Oh My Zsh is an open-source framework for managing Zsh configurations. It comes with a large number of plugins and themes that enhance the Zsh experience. To install Oh My Zsh, run the following command in the terminal:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Oh My Zsh has a rich set of plugins that extend its functionality.
git clone https://github.com/MichaelAquilina/zsh-you-should-use.git $ZSH_CUSTOM/plugins/you-should-use
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git $ZSH_CUSTOM/plugins/zsh-autocomplete
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/fdellwing/zsh-bat.git $ZSH_CUSTOM/plugins/zsh-bat
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Then add the plugin in the .zshrc
file:
plugins=(git you-should-use zsh-autocomplete zsh-autosuggestions zsh-bat zsh-syntax-highlighting)
also, to make zsh-bat
to work, bat
should be installed on your system.
brew install bat
sudo apt install bat
Finally, save the file and restart Zsh as follows: source ~/.zshrc
powerlevel10k
is a popular theme for Oh My Zsh that provides a rich set of features and customization options. To install powerlevel10k
, run the following command:
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
also, to make powerlevel10k
to work, Meslo Nerd Font
should be installed on your system.
brew install font-meslo-for-powerlevel10k
download the font from Nerd Fonts and install it manually.
Then set the theme in the .zshrc
file:
ZSH_THEME="powerlevel10k/powerlevel10k"
Finally, save the file and restart Zsh as follows: source ~/.zshrc
The command-line interface (CLI) is a text-based interface that allows you to interact with the shell using commands.
Here are some common commands and shortcuts that you can use in the shell.
ls
: List files and directories in the current directory.cd
: Change directory, e.g., cd Documents
will change the current directory to Documents
pwd
: Print the current working directory.Path is a string of characters that represents a file or directory. It can be either absolute or relative. An absolute path starts from the root directory, while a relative path starts from the current directory.
To use absolute paths, you need to specify the full path from the root directory. For example, C:\Users\John\Documents\file.txt
is an absolute path on Windows, while /Users/John/Documents/file.txt
is an absolute path on macOS and Linux. To use relative paths, you need to specify the path relative to the current directory. For example, Documents/file.txt
is a relative path that points to the file.txt
in the Documents
directory. On Windows, the path separator is \
, while on macOS and Linux, it is /
.
..
represents the parent directory, while .
represents the current directory. For example, ../Documents
represents the Documents
directory in the parent directory. On macOS and Linux, you can use ~
to represent the home directory.
touch
: Create an empty file, e.g., touch file.txt
will create a file named file.txt
.mkdir
: Create a directory, e.g., mkdir Documents
will create a directory named Documents
.rm
: Remove files and directories, e.g., rm file.txt
will remove the file file.txt
.