CLI
A command-line interface or CLI for short is an interface that allows you to interact with your computer through text-based commands. An interface to interact with your computer is known as a shell. Most modern operating systems come with both a text-based shell and a GUI based shell. The GUI based shell is generally known as the desktop environment.
Fedora Linux comes with the Bash shell by default. This is a very popular and common shell among many Linux distributions. This is the recommended shell to use when following this guide.
Font
The font used by your terminal can be changed. Some of the tools we will install later require a Nerd Font as an installation pre-requisite. Therefore it is recommended to install and use a Nerd Font as later instructions in this guide depend on it.
The Nerd Font recommended in this guide is Fira Code.
Installation
The Nerd Font Fira Code is not available from the default Fedora package repository. To install it we need to first add the third-party Terra package repository to our package manager:
sudo dnf install --nogpgcheck --repofrompath 'terra,https://repos.fyralabs.com/terra$releasever' terra-release
Now we can install the Nerd Font:
sudo dnf install firacode-nerd-fonts
To use the new font in your terminal configure you need to configure your terminal to use it.
Tip
To ensure your terminal can see all fonts installed (including the one we just installed) you need to close all terminal instances. Then once all instances are closed launch a new instance of the terminal emulator and only then go to the settings of the terminal emulator to change the font.
To configure the terminal emulator "Konsole" to use the new font open the "Konsole" terminal emulator and press the hamburger to open settings and select "Create New Profile...":
Name your new profile and switch to the Appearance tab to select a custom font:
Now select the font "FiraCode Nerd Font" and click "OK":
Set your new profile as the default profile and click "OK":
Configuration
The Bash shell can be configured using a configuration file located in your user's home directory. The name of the file is .bashrc. In my case it is located here:
/home/henrik/.bashrc
Customization
The configuration in .bashrc can be customized. Below you can find a few recommended customizations.
Prompt
The prompt that is displayed can be customized. An easy way to do this is to use Starship. To install Starship run the below in a terminal:
curl -sS https://starship.rs/install.sh | sh
Now append the below to your .bashrc file:
eval "$(starship init bash)"
The next time you open a terminal it should be using the default Starship prompt. The default Starship prompt is already quite useful. For example, if you are inside a git repository, the prompt displays what branch you are currently on. The prompt can be further customized by following the Starship Configuration guide.
Useful Information
A tool called Fastfetch can be used to display useful information such as operating system version, hardware information, network information, the current weather and more. It can be neat to display this information when opening a new terminal.
To use fastfetch you first need to install it:
sudo dnf install fastfetch
After installing the tool you can now use it from the command line by typing:
fastfetch
Now you should see the information fastfetch prints with the default configuration. The configuration can be customized. The configuration file can be found here:
~/.config/fastfetch/config.jsonc
If the configuration does not yet exist you can create one:
fastfetch -c all --gen-config-force
The Fastfetch configuration file I use can be found in the file config.jsonc in the Epic Fantasy Forge repository. That configuration file yields the below output:
To display the fastfetch output everytime you open a new terminal append the below to your .bashrc file:
fastfetch
Terminal Multiplexing
Sometimes you might want to use several terminal sessions simultaneously. For example you could use one session for editing code and another session for compiling and testing the code. In such cases a terminal multiplexer can be very useful. A terminal multiplexer allows you to have several terminal sessions open within a single terminal window. Furthermore it allows you to close the terminal window whilst still keeping the programs launched from that terminal window running.
The recommended terminal multiplexer in this guide is tmux. To install tmux run:
sudo dnf install tmux
To start tmux simply run:
tmux
The tmux getting started guide can be used to learn how to use tmux. A tmux session with multiple sessions looks like this: