Share your Bash prompts!
I'm looking for inspiration for a custom Bash prompt^[1]^. I'd love to see yours! π If possible, include both the prompt's PS1
, and a screenshot of what it looks like.
::: spoiler References
1. Type: Documentation. Title: "Bash Reference Manual". Publisher: Gnu Project. Edition: 5.2. Published: 2022-09-19. Accessed: 2025-03-21T02:46Z. URI: gnu.org/software/bash/manual/hβ¦.
- Β§6.9 "Controlling the Prompt". URI: gnu.org/software/bash/manual/hβ¦.
:::
Crossposts:
- sh.itjust.works/post/34840018
This entry was edited (2 months ago)
π¦πΊππ¦ππ₯ππππ£π πππππ
in reply to Kalcifer • • •quincunx
in reply to π¦πΊππ¦ππ₯ππππ£π πππππ • • •π¦πΊππ¦ππ₯ππππ£π πππππ
in reply to quincunx • • •U can fish on any Linux distro. Most major distros have binaries but those that don't u can easily build it with cargo.
Tldr yes.
macniel
in reply to π¦πΊππ¦ππ₯ππππ£π πππππ • • •Christopher
in reply to Kalcifer • • •Bash Prompt Generator
bash-prompt-generator.orgKissaki
in reply to Kalcifer • • •I'm usually not using bash locally, and remotely don't change the prompt, but Starship works in bash too.
I use Nushell with Starship (cross platform prompt) in Windows Terminal.
Path above prompt, prompt with shell name and a character, and on the right side how long the previous command took. The Character changes color from green to red when the last command exited with a non-0/-success exit code.
In a git repo folder it shows git info too - the branch symbol won't show here because here is not a nerd font with symbols; I'll add a screenshot:
Starship can show a bunch of status/state information for various tools, package managers, docker, etc.
I wouldn't show my
PROMPT_COMMAND
, but it's a nu closure so not really comparable to bash. But as I said, Starship works with Bash too.Starship: Cross-Shell Prompt
starship.rsπ½πππππππππ
in reply to Kalcifer • • •Not Bash, but zsh.
The host is there only because I'm usually logged in to 7 machines at once. The right prompt is the bare minimum path context, and the command # for easier !-re-execute; it disappears if the command gets long enough.
There's a bare minimum of cruft; no 2-line prompts, minimum verbosity in the prompt itself, because it's otherwise just noise that interferes with the output of whatever I'm doing and takes up space. It's especially important if I'm logged in via termux on my phone or something, where space is at a premium. What am I saying? Space is always at a premium.
$PS1 is
$RPROMPT is
NostraDavid
in reply to Kalcifer • • •You can see here my theme with autodetect of Python (I work a lot in Python). The orange bit is the error code returned by the previous command. Git is supported as well, and looks pretty much like
powerline-gitstatus
, as you'll read about below.First, lets make Bash a little better:
Autocd is a big one here, cdspell and direxpand as well. Ensures I don't need Zsh for the same experience. With Zsh I'd just get annoyed by small stuff like having to wrap things in quotes (I think
pip install some_lib[some_extra]
works in Bash, but not in Zsh And Ohmyzsh just felt it kept slowing things down, so I actually dislike Zsh ^(please don't kill me) >_>Anyway, I based this on
powerline-status
+powerline-gitstatus
(if you want to use that instead (no, my config doesn't work), justsudo apt install powerline-status powerline-gitstatus
- DO NOT USE THEPYPI
VERSION (it's too outdated, and a pain to install)) because I had issues with finding the right combination of my configuration and which libraries to install for bash - there are too damn many: powerline-bash, powerline-status, powerline-rs, powerline-go, etc, etc. And they all do things just that little bit different.Anyway, here is my
~/.config/starship.toml
(archive1, archive2). It's a little long, and can probably be shortered, but that might break something again, and I'm not willing to risk anything right now.~/.config/starship.toml - based on powerline-status + powerline-gitstatus
Gist