My Configs for a Fancy-Looking Terminal (starship, exa, fonts)
My starship and exa configs for a fancy command prompt in bash and pwsh (PowerShell). How to beautify the terminal with nerd fonts and a nice background. Making it work in Windows Terminal. Within an SSH session, under both root and non-root users.
My terminal environment is usually customized as follows:
- starship for a nice command-line prompt,
- exa for a nice directory listing instead of original
ls
, - nerdfonts for beautiful glyphs in the terminal application,
- Windows Terminal, as a terminal application for setting up all the beauty.
bash
is the main shell I usually work in.
๐ All instructions below work in a Linux environment including SSH sessions.
Terminal emulator allows rendering custom fonts and backgrounds (like those little cartoonish bulbs ๐ก). I use Windows Terminal as a terminal application (terminal emulator) in Windows for simultaneous access to different terminal environments and shells in different tabs, I mainly use two environments:
- Ubuntu in Windows Subsystem for Linux (WSL2) with
bash
shell. - Windows environment enabled with
pwsh
(PowerShell).
There are plenty of terminal emulators in different Linux distros, e.g. GNOME Terminal on Ubuntu, they can be configured to render different fonts and backgrounds.
๐ก Just remember:
- backgrounds and the fancy fonts ๐จ are in the terminal settings (GNOME, Windows Terminal)
- while the command prompt (๐ starship) is in the shell configuration (bash, fish, pwsh).
๐ Starship
Starship is used for a nice-looking command prompt.
How to Install
The following steps work in any Linux, you can even quickly beautify your SSH session on the remote host!
sudo apt install gcc cmake
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
cargo install starship
eval "$(starship init bash)"
Add the next line into ~/.bashrc
:
eval "$(starship init bash)"
Don't forget to apply.
source ~/.bashrc
How the command prompt finally looks:
Root User
๐ฎโโ๏ธ Additionally, set up starship
for the root user.
Change a shell user to be a root
user.
sudo su
vi ~/.bashrc
Add the following line into /root/.bashrc
(it's literally ~/.bashrc for the root user... and don't forget to change the "<user>
" part of the command line below - this is the non-root user you came from).
eval "$(/home/<user>/.cargo/bin/starship init bash)"
Run the command above in the command line or apply the config:
source .bashrc
How it finally looks for the root:
SSH
๐ You can install starship
on the remote node within an SSH session.
Just open an SSH session (like ssh alex@dsn-play-alex-01
in my case), and then follow the instructions above (rustup install , cargo install starship
, etc.) and you will able to see something as follows after ssh
login (command prompt shows you have a remote connection to some host):
๐ง Starship bash
config
It's about how exactly Starship is going to render the command prompt.
cat ~/.config/starship.toml
[shlvl]
disabled = false
threshold = 1
symbol = "โ๏ธ "
[shell]
disabled = false
bash_indicator = "๎ฏ"
[os]
disabled = false
format = "$symbol "
symbols.Ubuntu = "๎ฏ"
shlvl
config makes it show the number of a shell level, e.g. it shows "โ๏ธ 1" when running undermc
(Midnight Commander).shell
module helps identify a shell that is currently in use (bash
,fish
,pwsh
).os
module shows the operating system.
The last 2 options are needed because I can open a tab with PowerShell, and, with properly configured Starship, it allows me to recognize shells between each other quickly.
PowerShell Installation Notes
You can find instructions here: https://starship.rs/guide/#๐-installation
The biggest challenge is to find where is the PowerShell config. Mine was here: C:\Users\user\OneDrive\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
.
Here is its content:
# Starship
Invoke-Expression (&starship init powershell)
Meanwhile, the Starship config is here: $HOME/.config/starship.toml
.
๐ง Starship PowerShell pwsh
config
cat ~\.config\starship.toml
[shell]
disabled = false
powershell_indicator = "๎ฏ"
cmd_indicator = "๎ฏ"
[os]
disabled = false
format = "$symbol "
symbols.Windows = "๎"
How It Looks in Tabs
In the following example, I can quickly distinguish OS and shells via nice glyphs: ๎ฏ
๎ฏ
๎
๎ฏ
.
๎ฏ
๎ฏ
Tab #1 can be a WSL2 Ubuntu/Linux bash
terminal:
๎
๎ฏ
Tab #2 can be a PowerShell pwsh
terminal:
๐ฆ =exa=
exa
is a modern replacement for ls
written in Rust.
How to install:
sudo apt install exa
Modify ~/.bashrc
config. If the ls
alias is already defined there, then substitute it with the following line:
alias ls='exa --icons -F -H --group-directories-first --git -1'
--icons
shows the icons (I want a fancy look!)-F
type indicators-H
hard links--group-directories-first
list directories before other files--git
list each file's Git status-1
show a table listing, 1 entry by line
And ll
is usually already defined like this:
alias ll='ls -alF'
๐บ Windows Terminal
Finally, a proper setup of the Windows Terminal is needed to fully enable starship
and exa
showing fancy fonts (e.g. "nerd" glyphs ๎ฏ
, ๎ฏ
) on a custom background (๐ก) with support of different terminal environments (e.g. bash
, pwsh
).
-
Install the Windows Terminal from the Microsoft Store: https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701
-
Install Nerd Fonts. Download a "FiraCode Nerd Font": https://github.com/ryanoasis/nerd-fonts/releases/download/v2.3.3/FiraCode.zip
Find the
Fira Code Retina Nerd Font Complete Mono Windows Compatible.ttf
inside of the archive and install it (double click).๐ก You can find more nerd fonts at nerdfonts.com.
-
Set the Campbell color theme and FiraCode NFR Retina font, installed in the previous step:
-
Download my bulbs background (Right Click -> Save Image As...):
And set it in the Windows Terminal:
Voila!
My final setup is shown in the initial screenshot at the beginning of the article: