Table of Contents
Today, In this article we will show you how to Customize Linux Terminal Prompt Using Starship. The enormous level of customization that Linux-based operating systems provide us with is one of their best qualities. Almost everything, including the choices the kernel is built with and the desktop environment, may be altered and tailored to suit our needs.
The terminal emulator is a crucial tool for system administrators and power users on any Linux distribution. By utilizing a range of modules, the free and open source Starship plugin made in Rust allows us to personalize our own shell prompt. A text-based interface called the Linux terminal is used to manage Linux computers. It is merely one of the many tools accessible to Linux users for carrying out any given activity, but it is often regarded as the most effective approach.
It’s undoubtedly the most direct approach there is, barring the creation of code. It’s really become so well-liked that Microsoft created PowerShell, its very own open source command line, while Apple switched to using Unix as its foundation and acquired access to the Bash and Z shells. We mentioned below are the steps to customize Linux Terminal Prompt Using Starship.
Steps to customize Linux Terminal Prompt Using Starship
Install Starship
Step 1: To install starship, go to your home directory and run the following command.
curl -sS | sh
Step 2: This command will download and install starship binary and add it to your path.
Install Starship on Your Shell
Step 1: If you are using a bash shell, open your “~/.bashrc” file and paste this line of code at the end.
eval “$(starship init bash)”
Step 2: If you are using Zsh, open your “~/.zshrc” file instead and paste the above line of code at the end of it.
Step 3: Now restart your terminal app. You will be greeted by the default starship prompt.
Step 4: If you have some other shell rather than the above two, go to starship documentation and find your preferred shell there.
Customize Starship
Step 1: 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
Step 2: You can also change the default location of the starship configuration file. To change the default location of your starship configuration file, add the STARSHIP_CONFIG environment variable at the bottom of your “~/.bashrc” file.
export STARSHIP_CONFIG=~/example/non/default/path/starship.toml
Prompt Customization in Starship
Step 1: The prompt customization of starship has 4 options. We can change these 4 options to customize the prompt style.
Uninstall starship
Step 1: To uninstall starship, first, delete your starship config file.
rm ~/.config/starship.toml
Step 2: Then remove the line you have pasted during installation inside the “~/.bashrc” file.
Step 3: At last, uninstall the starship binary from your device.
sh -c ‘rm “$(command -v ‘starship’)”‘
Step 4: Now relaunch your terminal and your prompt restored to the default style.
Final Words
We hope you like our article on how to customize Linux Terminal Prompt Using Starship. A cross-shell prompt built in the rust language is called Starship. This terminal prompt is incredibly simple and incredibly quick. Its flexibility to be customized is the main factor in its popularity. A TOML configuration file can be used to simply customize it. Simply change the config file to the proper position if you are switching to a different device or shell, and your stunning shell will be ready immediately.