Prettier prompts for the bash

Here wizards, magicians, sorcerers and everybody can rest a bit and talk about anything they like.

Just remember to respect the rules.

Prettier prompts for the bash

Postby xtapetae » Aug 1st, '17, 01:32

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/
xtapetae
 
Posts: 11
Joined: Aug 29th, '13, 21:10

Re: Prettier prompts for the bash

Postby xboxboy » Aug 1st, '17, 05:39

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.
xboxboy
 
Posts: 297
Joined: Jun 2nd, '13, 06:41


Return to The Wizards Lair

Who is online

Users browsing this forum: No registered users and 1 guest