Last night I saw some old friends that I hadn't seen in years. It was a jolly reunion, and I drank way too much. Consequently, I've got a tad bit of a hangover, thus my brain is not functioning on par. It's also about 90 degrees here in [undeclared], USA today, so nobody feels like doing much of anything. To kill the time, figured I'd create some cool bash color prompts and post them.
This one is easy on the eyes and not too distracting.
export PS1="\[$(tput setaf 7)\]\u\[$(tput setaf 1)\]@\[$(tput setaf 7)\]\h\[$(tput setaf 6)\]:\[$(tput setaf 4)\]\W\[$(tput setaf 5)\]\\$ \[$(tput sgr0)\]"
user@yourbox:~$
But personally I prefer a very minimal colorized prompt, because (like it says in the .bashrc file already), it's distracting and the focus the of terminal ought to be more about the output than the prompt. However, a little itty bit of color never killed anyone:
export PS1="\[$(tput setaf 7)\]\u\[$(tput setaf 7)\]@\[$(tput setaf 7)\]\h\[$(tput setaf 2)\]:\[$(tput setaf 4)\]\W\[$(tput setaf 6)\]\[$(tput setaf 1)\]\\$\[$(tput setaf 6)\]\[$(tput sgr0)\]"
user@yourbox:~$
I think it's a nice touch.
For root accounts, I find it useful to add a bold red prompt to remind myself to not stay logged in as root as any longer than absolutely neccessary. Something like this:
export PS1="\[$(tput bold)\]\[$(tput setaf 7)\]\u\[$(tput setaf 5)\]@\[$(tput setaf 7)\]\h\[$(tput setaf 4)\]:\[$(tput setaf 1)\]\W\[$(tput setaf 1)\]\\$ \[$(tput sgr0)\]"
root@yourbox:~#
Another variation...
export PS1="\[$(tput bold)\]\[$(tput setaf 7)\]\u\[$(tput setaf
1)\]@\[$(tput setaf 7)\]\h\[$(tput setaf 2)\]:\[$(tput setaf
4)\]\W\[$(tput setaf 6)\][\[$(tput setaf 1)\]\\$\[$(tput setaf
6)\]]\[$(tput sgr0)\]"
root@yourbox:~[#]
Oh yeah, rather than doing all this manually, there is this awesome website that has a bash prompt generator: https://www.kirsle.net/wizards/ps1.html#
Jeeze I've spent an hour doing this already. I guess that's all for today, folks.
Edit: I found the configuration I was looking for! This is much better, because the path is not colored as well, which is just plain annoying... For example..
user@host:~$/etc/default
... is just silly. This is what I was going for:
For user:
export PS1="\u@\h\[$(tput setaf 1)\]:\[$(tput setaf 7)\]\w\[$(tput setaf 2)\]$ \[$(tput sgr0)\]"
you@yourbox:~$ cd /etc/default
you@yourbox:/etc/default$
And a nice red prompt for root:
export PS1="\u@\h\w\[\e[36m\]:\[\e[m\]\[\e[31m\]\\$\[\e[m\] "
root@yourbox:#~ cd /etc/default
root@yourbox/etc/default:#
Much better.
No comments:
Post a Comment