Bash - Starship Prompt (2023)

The customization of a prompt is very often just some "optical enhancements". Some colors here and maybe some behavior there. If you want to have additional functionality, you may want to have a look at Starship. A blazing fast prompt with lots of cool features.

Starship

The Starship Prompt is fast, customizable and packed with features. It also supports multiple shells, but I will focus on Bash for this article.

Integrations

Other prompts offer things like a Git indicator or coloring, based on the user. Starship can do the same, but also much more. It can detect various settings and the context of your working directory to show all kind of things like:

Bash - Starship Prompt (1)

Fast and minimal

By default, the prompt is as fast (or even faster) than Powerline-Go. This makes it a breeze to use, since you will never wait that your prompt is ready.

It comes in a really minimal way. All modules can be enabled or disabled to your personal liking.

Customizable

When it comes to customizations, you can tweak the behavior, modules and optical setup in nearly every way. Even better, you can do this with a quite simple TOML configuration file.

💡

(Video) The Starship Prompt Offers Infinite Possibilities

This guide is tested on Fedora 36 with Starship 1.2.1.

Installation

So, how do you get it installed and running?

Starship uses so called Nerdfonts to display symbols and enhanced characters. Nerdfonts are patched sets of Fonts that allow these special characters. As a prerequisite, you should ensure that one is installed on your system and your terminal is configured to use these.

I opted for FiraCode. You just need to download the ZIP archive and install one of the fonts, that you like. Afterwards, you can configure the font in your Terminal. You can also configure the new Font via GNOME Tweaks, so it is used for all Monospace characters.

Bash - Starship Prompt (2)

Starship is already packaged for Fedora and the installation is just a command away.

# Install starship$ sudo dnf install starship

Afterwards, you can enable the prompt for your current user with a simple addition to the end of your .bashrc file.

# .bashrc...SNIP...eval "$(starship init bash)"

Afterwards, you can start to enjoy and customize your prompt.

Customization

By default, Starship comes with several modules enabled and looks pretty minimal. As already stated, you can tune this with a single configuration file. Let's explore this a bit.

(Video) A Linux Shell Prompt That's Out Of This World!

First, you need to create a configuration file in your home directory.

# Create the directory (if not existing)$ mkdir ~/.config# Create the starship configuration file$ touch ~/.config/starship.toml

Afterwards, you can put your configurations in there and after writing the file, the changes will be effective immediately. The below snippet is my current configuration.

# Keep the newline after each promptadd_newline = true# Show the battery level if under 20%[[battery.display]]threshold = 20# Show the regular bash prompt symbols[character]success_symbol = "[\\$](bold green)"error_symbol = "[\\$](bold red)"# Enable the Kubernetes module[kubernetes]disabled = false

You can configure really everything to your liking, and all modules are documented on the Starship website.

In case you want to add your own custom functions, you can do this as described in the advanced configuration.

Presets

Configuring everything from scratch can be a huge effort. If you need some ideas, the Starship website provides some cool presets to start from.

Docs & Links

Here you can find all the links that were helpful for me.

Starship: Cross-Shell Prompt

(Video) Painless prompt setup with Starship [Terminal Velocity 3]

Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and Powershell.

Bash - Starship Prompt (3)

Bash - Starship Prompt (4)

Nerd Fonts - Iconic font aggregator, glyphs/icons collection, & fonts patcher

Iconic font aggregator, collection, & patcher: 3,600+ glyph/icons, 40+ patched fonts: Hack, Source Code Pro, more. Popular glyph collections: Font Awesome, Octicons, Material Design Icons, and more

Bash - Starship Prompt (5)Nerd FontsRyan L McIntyre

Bash - Starship Prompt (6)

(Video) Starship Prompt: Building Custom Modules

Customize your Bash prompt on Linux with Starship

Explore how the principles behind open source--collaboration, transparency, and rapid prototyping--are proven catalysts for innovation.

Bash - Starship Prompt (7)Supported by Red HatMoshe Zadka

Bash - Starship Prompt (8)

Conclusion

Starship really impressed me. I already switched it to my defaults and will ensure to update my Dotfiles repository and the Ansinle whiletruedoio.general bash role very soon.

Which prompt do you use? How have you customized it? I would love to get a screenshot or configuration preset that demonstrates your prompt.

Tags

Videos

1. New *incredible* mac OS terminal! (warp + starship + zsh)
(Christian Lempa)
2. Spaceship: My New Favourite Minimalist Zsh Prompt
(Brodie Robertson)
3. Make Windows Terminal look amazing!
(Christian Lempa)
4. Beautiful Bash
(Chris Titus Tech)
5. Lesson 5 - Configuring Starship Prompt
(Trusty Rusty Depot)
6. Starship Prompt - Customising Windows Powershell
(MrShawnSimplifies)
Top Articles
Latest Posts
Article information

Author: Carlyn Walter

Last Updated: 04/04/2023

Views: 5619

Rating: 5 / 5 (70 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Carlyn Walter

Birthday: 1996-01-03

Address: Suite 452 40815 Denyse Extensions, Sengermouth, OR 42374

Phone: +8501809515404

Job: Manufacturing Technician

Hobby: Table tennis, Archery, Vacation, Metal detecting, Yo-yoing, Crocheting, Creative writing

Introduction: My name is Carlyn Walter, I am a lively, glamorous, healthy, clean, powerful, calm, combative person who loves writing and wants to share my knowledge and understanding with you.