Starship Prompt

I would like to share a nice ‘secret’. I want to introduce you to the Starship prompt! This is a getting started guide for Starship. I’m using Starship every day.

Starship Prompt, not to be confused with the Starship from SpaceX 😆 , is a cross-shell prompt written in Rust. The prompt works in any common shell you may already use under GNU/Linux, like Bash.

In fact, Starship prompt works under any shell under any operating system.

Why?

Why would you want to use Starship prompt in the first place? Let’s say you are already using Bash.

Well.. If you are a software engineer like myself. Starship is very useful. It extends your terminal with additional features. It’s not a replacement of Bash, instead Starship is more an addition.

Starship will display additional information of many of your projects, like Git, Java, PHP, Ruby, Rust, Scala, JavaScript / NodeJS, Python, CMake, … and many more. They call it modules within Starship.
For example Starship will show you information about when you enter a git repository using the Git modules.

Starship shows you the current git branch that is checked-out and the latest git tag. It also shows you in the terminal if you have any uncommitted changes left to commit. As well as if there are git commits that still need to be pushed, using the git status module.

Starship live in action
Starship live in action

Getting started

Download and install the Startship prompt with the terminal via:

sh -c "$(curl -fsSL https://starship.rs/install.sh)"

Now add Starship to your favorite shell (example below is for the Bash shell).
Add the following line to the end of the ~/.bashrc file:

eval "$(starship init bash)"

Now, close your terminal and reopen a new terminal window. And Voilà!

You are running Starship!

Note: If you are running into font / icon issues, try installing a nerd font, to be sure you have all the icons available within the terminal.

Configuration

The default configuration is actually pretty good already. That being said, Starship offers a ton of configuration options to customize your experience. So again, the following section is optionally.

Did you know?

There are general configuration settings for Starship, but almost each Starship module has additional configuration options available.

If you want to adapt the Starship configuration, create a new file: ~/.config/starship.toml.

The content of this file is up to you. See the Configuration docs web page fore more info. An example of the content of starship.toml:

# Increase Starship command scan & duration time-outs
scan_timeout = 80
command_timeout = 1000

# Do not add new line
add_newline = false

# Do not truncate the directory listing
[directory]
truncation_length = 0

# Show even very fast command executions in terminal (in ms)
[cmd_duration]
min_time = 5
show_milliseconds = true

Restarting your terminal should apply the new changes.

Hint: Check-out my my dotfiles repository as well. This git repository contains more files besides my startship.toml file.

If you are still reading this, try out Fish shell as well 🙂 . Yes, Starship works perfectly fine under Fish shell.

Related posts