How to Customize Your Linux Terminal Prompt Using Starship

Starship is a cross-shell prompt build using the rust language. This is a very minimal and extremely fast terminal prompt. The main reason for its popularity is its customization. You can easily customize it using a TOML configuration file. If you switch to another device or another shell, just move the configuration file to the appropriate location, and automatically your beautiful shell will be ready.


Before using Starship, you need to install a nerd font on your computer. Nerd font is a nice mix of font and icons. Go to Nerd Fonts and download your favorite. If you can’t decide, you can also preview the fonts on

In my case, I like the “Fira Code Nerd font”. Download the font and extract the content it contains. You will get a folder named “FiraCode” and all .otf and .ttf versions of the font.

To install this font, go to your terminal and run the following command.

# Creating the local font directory in your system
mkdir ~/.local/share/fonts
# Moving the extracted fonts to local font directory
mv FiraCode ~/.local/share/fonts/

FiraCode Nerd font is now available in your system. You can also install other types of fonts by following the guide above.

If you like reading a detailed guide on installing fonts on a Linux desktop, check out this article on installing fonts in Ubuntu.

Install the spaceship

To install Starship, navigate to your home directory and run the following command.

curl -sS | sh

This command will download and install the spaceship binary and add it to your path.

Install Starship on your hull

If you are using a bash shell, open your “~/.bashrc” file and paste this line of code at the end.

eval "$(starship init bash)"

If you are using Zsh, open your “~/.zshrc” file instead and paste the above line of code at the end.

Now restart your terminal application. You will be greeted by the default ship prompt.

Ship Demo 1

If you have another shell rather than the two above, go to the spacecraft documentation and find your preferred shell there.

Customize the ship

To customize your shell prompt, create a “starship.toml” file in your config directory.

# Creating your .config directory if not existed
mkdir -p ~/.config
# Creating a new starship.toml file
touch ~/.config/starship.toml

You can also change the default spacecraft configuration file location. To change the default location of your spaceship configuration file, add the STARSHIP_CONFIG environment variable at the bottom of your “~/.bashrc” file.

export STARSHIP_CONFIG=~/example/non/default/path/starship.toml

Notion of module and variable

A module is a component of the terminal prompt, which gives you contextual information about the underlying operating system. For example, Nodejs is a module in the spaceship prompt. When we add this module to the configuration file, it gives us different data points regarding the current installation of Nodejs in your environment.

The module gives this information in terms of variables. Variables are smaller subcomponents that contain information about the module. For instance, version is the variable of “Nodejs”. When we call the $version Inside the Nodejs module, it gives us the currently installed version of Nodejs in your system. Variables are prefixed by $ symbol. The name of a variable can only contain letters, numbers and “_”.

Text groups and styles

Text groups in Starship contain 2 parts. The first part is attached as [ ] symbol. This part is called the format string. We can add texts, variables and even nested text groups here.

This last part is attached as ( ) and this is called the style string. You can style the text group using this style string.

Let’s take an example.

  • [make_tech_easier](yellow bold) will print the string “make_tech_easier” with bold text and yellow color.
  • [👍 All Done](green) will print “👍 All Done” in green.
  • [a [b](green) c](red) This is an example of nested text groups. It prints a and vs in red and b in green.

A few more style settings

  • We can set different foregrounds and backgrounds for text groups. [ ](fg:red bg:blue) make the text font color red and the background blue.
  • We can also use ANSI colors in the configuration file. [ ](bold fg:27) represent bold text with ANSI color 27 as the foreground color.
  • If you want to add your hex color, that is also possible. [ ](underline bg:#bf5700) results in underlined text with a bright orange background color.
Ship Demo 2

Quick customization in Starship

Quick Ship Customization has 4 options. We can modify these 4 options to customize the prompt style.

  • format: It defines what the prompt would look like inside the terminal. You can set any design as a prompt.
  • scan_timeout: Timeout for spaceship to scan files.
  • command_timeout: Timeout for the command executed by the ship.
  • add_newline: It is a boolean. If set to true, it adds a blank line between the shell prompt.

A demo prompt customization file looks like this.

# Use custom format
format = """
[┌───────────────────>](bold green)
[│](bold green)$directory$rust$package
[└─>](bold green) """
# Wait 10 milliseconds for starship to check files under the current directory.
scan_timeout = 10
# Disable the blank line at the start of the prompt
add_newline = false

Add the desired module

Now that you know the basics of the spaceship and how to customize it, you can add the desired module very easily. Keep in mind that any module will work if the files and folder related to that module will show up at the given path. Simply, the python module will only be visible if a python file is present in the current working directory.

Let’s add the python module to our spaceship setup as a demo. open your starship.toml file. There add [python] in a new line to activate the python environment.

The Python module displays information about whether Python is installed in your operating system or if a virtual environment is enabled. If you want to change the python icon and show the virtualenv name, the config file looks like this.

symbol = "🐍 "
pyenv_version_name = true

If you have both python2 and python3 installed, you can specify the default python binary using starship’s configuration file.

# Only use the `python3` binary to get the version.
python_binary = "python3"

Like this example, you can add any module you want and customize them according to your imagination.

How to Add Spaceship Presets

If you don’t want to do all these customizations yourself, but want a nice terminal prompt out of the box, you can use presets. Presets are simply ship configuration files shared by other users. You can import these presets into your config file and you have a nice terminal prompt in an instant.

Starship Invite Powerline 700px

You can explore official presets on this page. The terminal prompt above is uploaded by a user and available on the presets page. Now to make your terminal prompt look like this, open your spaceship’s configuration file and add this configuration to your file.

format = """
[→](bg:#DA627D fg:#9A348E)
[→](fg:#DA627D bg:#FCA17D)
[→](fg:#FCA17D bg:#86BBD8)
[→](fg:#86BBD8 bg:#06969A)
[→](fg:#06969A bg:#33658A)
[→ ](fg:#33658A)
# Disable the blank line at the start of the prompt
# add_newline = false
# You can also replace your username with a neat symbol like  to save some space
show_always = true
style_user = "bg:#9A348E"
style_root = "bg:#9A348E"
format = '[$user ]($style)'
style = "bg:#DA627D"
format = "[ $path ]($style)"
truncation_length = 3
truncation_symbol = "…/"
# Here is how you can shorten some long paths by text replacement
# similar to mapped_locations in Oh My Posh:
"Documents" = "📄 "
"Downloads" = "📥 "
"Music" = "🎜 "
"Pictures" = "📷 "
# Keep in mind that the order matters. For example:
# "Important Documents" = "  "
# will not be replaced, because "Documents" was already substituted before.
# So either put "Important Documents" before "Documents" or use the substituted version:
# "Important  " = "  "
symbol = "© "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
symbol = "🐳 "
style = "bg:#06969A"
format = '[[ $symbol $context ](bg:#06969A)]($style) $path'
symbol = "💧 "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
symbol = "🌳 "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
symbol = "☊"
style = "bg:#FCA17D"
format = '[[ $symbol $branch ](bg:#FCA17D)]($style)'
style = "bg:#FCA17D"
format = '[[($all_status$ahead_behind )](bg:#FCA17D)]($style)'
symbol = "🐹 "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
symbol = "λ "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
symbol = "☕ "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
symbol = "ஃ "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
symbol = "🔷 "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
symbol = "👑 "
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
symbol = "🦀"
style = "bg:#86BBD8"
format = '[[ $symbol ($version) ](bg:#86BBD8)]($style)'
disabled = false
time_format = "%R" # Hour:Minute Format
style = "bg:#33658A"
format = '[[ 🤍 $time ](bg:#33658A)]($style)'

Restart your terminal and your terminal prompt will look exactly like the prompt in the picture. You can search for other terminal prompt presets and try the one that works best for you. In the meantime, if you want to try some bash tips and tricks, this article should be the best for you.

How to uninstall Starship?

To uninstall Starship, start by deleting your Starship configuration file.

rm ~/.config/starship.toml

Then delete the line you pasted during installation in the “~/.bashrc” file.

Finally, uninstall the spaceship binary from your device.

sh -c 'rm "$(command -v 'starship')"'

Now relaunch your terminal and your prompt restored to default style.

Frequently Asked Questions

How do I apply my current terminal prompt style to another device?

It’s very easy. Simply copy your ship’s configuration file located in your ~/.config/starship.toml to the other device. Install the spaceship, restart the terminal and you’re done.

What are the alternatives to the spaceship?

There are many spaceship alternatives that you can find online. For the zsh shell, oh-my-zsh is a very popular utility. Similarly, for fish shells, oh-my-fish is also a well-known tool that people use to customize their shell prompt. Another is spatialship. this is a customizable zsh prompt. Some other popular options are pure and synth-shell.

Was this article helpful?

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Comments are closed.