Page 1 of 1

Prettier prompts for the bash

PostPosted: Aug 1st, '17, 01:32
by xtapetae
It is not difficult to change the vanilla prompt that comes with Mageia to something more (for me) attractive. I prefer to have something like:

me@myhost:~>

And when opening a root shell I want it to remind me of that fact in a fat and red font:

root@myhost:me#

It is easy to change the prompt (and tempting to spend a lot of time with experimenting):
The first version requires the following line in the config file .bashrc which is in the home directory of every user:

PS1="\u@\h:\W> "

The fat red root prompt can be obtained by putting the following line in the .bashrc in /root/.bashrc:

PS1="\e[01;31m\u@\h:\W# \e[00m"

There are almost unlimited possibilities. Tutorials for changing the bash prompt are many, e.g.
here: https://www.cyberciti.biz/tips/howto-li ... rompt.html
or here: https://wiki.ubuntuusers.de/Bash/Prompt/

Re: Prettier prompts for the bash

PostPosted: Aug 1st, '17, 05:39
by xboxboy
or if you're like me, lazy, or not interested in clogging my brain up with another config file you can just use a package from the repos: as root

Code: Select all
urpmi colorprompt


Nice green prompt for users, red for root. It's the second thing I do on a fresh system after the post install update.