Skip to content

Customizing Shells

Bash

Customize Prompt

You can customize the Bash shell prompt by editing the PS1 variable in ~/.bashrc. For example, the current shell prompt is the following:

Terminal window
PS1="\e[1;32mβ”Œβ”€β”€[HQπŸš€πŸŒ\e[1;31m$(ip -4 addr | grep -v '127.0.0.1' | grep -v 'secondary' | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | sed -z 's/\n/|/g;s/|\$/\n/' | rev | cut -c 2- | rev)πŸ”₯\u\e[1;32m]\n└──╼[πŸ‘Ύ]\[\e[1;36m\]\$(pwd) $ \[\e[0m\]"

The emoji used on PS1 come from Emojipedia. For showing them on terminal, the noto-fonts-emoji package is needed.

Fish

Customize Prompt

You can customize the Fish shell prompt by editing ~/.config/fish/functions/fish_prompt.fish. For example, you can start to edit the shell prompt in Athena that is:

function fish_prompt
set -l var (tty)
switch $var
case '*/dev/tty*'
set_color 00ff00
echo -n "[HQ:"
set_color ff00d7
echo -n "$(ip -4 addr | grep -v '127.0.0.1' | grep -v 'secondary' | grep -oP '(?<=inet\s)\d+(\.\d+){3}' |>
echo -n " | $USER"
set_color 00ff00
echo "]"
set_color 00ff00
echo -n "[>]"
set_color 00ffff
echo (pwd) '$' (set_color normal)
case '*'
set_color 00ff00
echo -n "β”Œβ”€β”€[HQπŸš€πŸŒ"
set_color ff00d7
echo -n "$(ip -4 addr | grep -v '127.0.0.1' | grep -v 'secondary' | grep -oP '(?<=inet\s)\d+(\.\d+){3}' |>
echo -n "πŸ”₯$USER"
set_color 00ff00
echo "]"
set_color 00ff00
echo -n "└──╼[πŸ‘Ύ]"
set_color 00ffff
echo (pwd) '$' (set_color normal)
end
end

After saving the file, the shell will wait for something. Just close it.

For different colors, refer to the ANSI escape code web resouce and pass the mouse over the colors for getting the HEX code, for example:

set_color ff8700 -> Orange
set_color 00ff00 -> Green
set_color 00ffff -> Cyan
set_color ff00d7 -> Purple
set_color 123e7c -> Dark Blue

Zsh

Customize Prompt

You can customize the Zsh shell prompt by editing the PROMPT variable in ~/.zshrc. The Athena OS default shell prompt appears as:

Terminal window
PROMPT="%F{46}β”Œβ”€β”€[HQπŸš€πŸŒ%F{201}$(ip -4 addr | grep -v '127.0.0.1' | grep -v 'secondary' | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | sed -z 's/\n/|/g;s/|\$/\n/' | rev | cut -c 2- | rev)πŸ”₯%n%F{46}]"$'\n'"└──╼[πŸ‘Ύ]%F{44}%~ $%f "

PowerShell

Customize Prompt

You can customize the PowerShell prompt by editing ~/.config/powershell/Microsoft.PowerShell_profile.ps1 and modifying its content:

Terminal window
function prompt()
{
$ESC=$([char]27)
"$ESC[1;31mβ”Œβ”€β”€L3ts D0 1t $(whoami)πŸ’₯$ESC[00m$($executionContext.SessionState.Path.CurrentLocation)$("`r`n$ESC[1;34m└──╼Weaponizing PowerShell...πŸš€>$ESC[00m" * ($nestedPromptLevel + 1)) ";
}

Switching Shell

If you have installed more than one shell and you wish to use mainly one, just edit the export SHELL= line in ~/.bashrc by adding the name of your favourite shell, for example:

Terminal window
export SHELL=$(which fish)