Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,479
Rep:
I don't need to know the hostname, or which directory I'm presently in, because I will be using a file manager, often mc, if I am running around in the system, & most tell you which directory you are in; if not, I'll just switch back to my home directory before doing work, (cd or cd ~).
heh. Jeremy is obviously running out of ideas for polls.
heh. Maybe not.
Personally, I just accept the default and do not futz. Maintaining personal preferences across multiple systems is too much of a chore.
I've had no trouble tweaking my regular user prompt, but I'd also like to tweak the root prompt to be red and yellow but can't figure out how to do that. I've searched this forum and the webs (here, here, and here were the best I found). I tried editing /root/.bashrc, but that doesn't seem to do anything. My prompt settings are in ~/.bashrc and look like this:
Code:
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[00;32m\]u\[\033[00;37m\]@\[\033[00;32m\]\h\[\033[00;37m\]:\[\033[00;34m\]\w\[\033[00;37m\]\$\[\033[00m\] '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
Most of what I read is someone saying 'For regular users, I use
but these are almost identical except for one color change. No one has said where to put this code or how Bash will know which to use.
Can someone please help this poor tortured soul and tell me where to put the PS1 settings for root? Or, how to I differentiate the root settings from the regular user settings?
Re #39
Yes, the prompt for a user is defined in that user’s .bashrc Note that you’ll need to source it, or log out and back in to see any changes you make.
Re #39
Yes, the prompt for a user is defined in that user’s .bashrc Note that you’ll need to source it, or log out and back in to see any changes you make.
Would you mind elaborating? You're speaking in the short-hand of someone who knows, and I'm not able to interpret it.
Would you mind elaborating? You're speaking in the short-hand of someone who knows, and I'm not able to interpret it.
You asked about how to manage different prompts for different users. I pointed out that what you “understood” is correct. You need to set the prompt for each user in the user’s .bashrc...so the colored prompt for root goes in /root/.bashrc
Also, changes to a user’s .bashrc are not immediate...you’ll need to log out and back in to see them...or source the file:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.