2 Line Bash Terminal with EOS colors

Just wanted to tweak my prompt a little bit and threw this together for anyone using bash that likes the zsh 2 line prompt but prefers bash. The text you type will be white, if you guys want one for lighter prompts i can adjust it or you can.

screenshot

you just need to add this line to your .bashrc in your home directory


PS1="\033[38;5;209m\]┌[\033[38;5;141m\]\u\033[38;5;209m\]:\033[38;5;105m\]\h\033[38;5;231m\]\W\033[38;5;209m\]]\n\033[38;5;209m\]└\\[\033[38;5;209m\]$\[\033[37m\] "

EDIT: version with kali linux style offsets
PS1="\033[38;5;209m\]┌──[\033[38;5;141m\]\u\033[38;5;209m\]:\033[38;5;105m\]\h\033[38;5;231m\]\W\033[38;5;209m\]]\n\033[38;5;209m\]└─\\[\033[38;5;209m\]$\[\033[37m\] "

and that should be all you need (its all i did)

if you want to remove your username and host from the title bar you can add


PROMPT_COMMAND='echo -en "\033]0;Terminal\a"
8 Likes

made a quick adjustment to the bluish color (found one closer to EOS blueish purple) and separated the directory color from host, OP has been edited

As I used to often modify my prompt, I set up a couple of aliases to make it easier to get the colours as needed - so here is a section of my .bashrc setup that gives you the building blocks for your own choices:

Example prompt
BLACK="\e[1;30m"
RED="\e[1;31m"
GREEN="\e[1;32m"
YELLOW="\e[1;33m"
BLUE="\e[34m"
PURPLE="\e[1;35m"
CYAN="\e[1;36m"
WHITE="\e[1;37m"
LTBLACK="\e[1;90m"
LTRED="\e[1;91m"
LTGREEN="\e[1;92m"
LTYELLOW="\e[93m"
LTBLUE="\e[1;94m"
LTPURPLE="\e[95m"
LTCYAN="\e[1;96m"
LTWHITE="\e[1;97m"
RESET="\e[0m"
PS1="\n┌\[${LTRED}\]\t \[${LTPURPLE}\]WD= \[${YELLOW}\][\w]\n└───\[${GREEN}\]\u\[${YELLOW}\]@\[${LTBLUE}\]\h\[${RESET}\] ─▶\$ "

This gives you this:
qwik-prompt as a reference.

choices are good!
5 Likes

Very haxx0r, much 1337, wow! :rofl:

Except this part:

Don’t do that, that’s very inelegant… Just modify the PS1 to suit your needs.

@freebird54 if your terminal emulator supports truecolor, you can use \e[38;2;${RED};${GREEN};${BLUE}m (for foreground) and \e[48;2;${RED};${GREEN};${BLUE}m (for background), where RED, GREEN, and BLUE are integers between 0 and 255.

Now you should make 16777216 named variables, one for each colour, just in case1. :rofl:


1 If you think that’s crazy, I would point out that it’s only 1048576 times crazier than your 16 named variables.

1 Like

If you like 2 line bash prompt, with zsh similarities, you may like this one:

PS1 env var
PS1='\[\e[0;96m\]\t\[\e[0m\]$( Terr=$? ; if [ ! $Terr = "0" ]; then echo -e " "'\\[\\e[0\\\;1\\\;41m\\]' "Err:$Terr" '\\[\\e[0m\\]' ; fi ) [\[\e[0;32m\]$(echo ${LOGNAME:+me})\[\e[0m\]@\[\e[0;91m\]\s\[\e[0m\]] \[\e[0m\]{\[\e[0;1;2;96m\]$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\[\e[0m\]}\[\e[0;92m\]\w\n\[\e[0;1;41m\] >>> \[\e[0;38;5;214m\] \$ \[\e[0m\]'

No username, $SHELL instead of hostname, show error Nr only with non-zero error, git info.

PS1-bash-prompt

2 Likes

Thats the only thing that seems to work with gnome terminal. Changing PS1 doesnt remove user/host from the title bar.

Don’t do that, that’s very inelegant…

rofl

2 Likes

Come on - I never claimed it was comprehensive! Just a way to avoid having to look codes up when making changes… :grin:

Also, I find it useful when swapping to terminals in ‘other’ builds, where I might have different backgrounds in the terminal - or for occasions (now rare) where I have the background colour on each terminal when it opens. Rare, because I now don’t often need more than one open at a time (drop-down is so handy).

Perhaps I could just say that expansion and modification is left as an exercise for the user? :rofl:

1 Like

Just to let you know I implemented your code. Many thanks for that, makes the terminal a bit more fun to look at.

I am not sure I understand you fully. I think you are saying based on use case, you change the prompt colors? If so, wouldn’t it be easier to write a txt file with the codes for your different use cases and then source those in to your .bashrc instead of changing the .bashrc based on use case?

Your machine - your ways! Actually, I have a .bashrc-personal file that gets sourced in (if present) that contains all of that, and a pile of other aliases that I have become ‘addicted’ to over the years. For instance, my update routine uses an alias chain like so:

alias suc='su-c_wrapper'
alias spacman='suc pacman --color auto'

so to run an update I just type ‘sp’ and UpEnter to get it going. Who said being terminal centric needs a lot of typing? :grin:

Of course, it wouldn’t be that hard to wedge it into the ‘main’ .bashrc - but the default .bashrc varies between different system builds so it’s easier (for me) to just point things at a copy of .bashrc-personal…

Elegant or not, works like a charm. Thank you.