Red HatThis forum is for the discussion of Red Hat Linux.
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.
Is there any way to get the terminal window prompt for normal users to show the current full path that they are in, rather than just bash-2.05b$? I know the root user will show the current folder, and the entire path at the top of the window, but other users don't see that. Is there any way to get that to show up in RedHat 9?
AFAIK, if you save your setting in /etc/profile, each user will inherit the same prompt - but there's nothing to stop them changing it themselves of course.
Cool, that link helps a lot. I can get it set up just how I like it... but so far haven't been able to get it to stick. As soon as I close the terminal window, the prompt reverts back to normal. The How-to touches on what they think might work to save it, but they don't know for sure. I've tried adding the PS1 line into both profile and bashrc files in the /etc folder, without success. The link seems to think the bashrc file is the right place, but they don't really mention if it needs to be put anyplace in specific. So, I'm almost there now (and still looking), but if anyone has gotten their prompt settings to stick, I'd love to hear it.
Hmm... Still no go with this. I even put that line in a couple different places, with and without the export, just to see if something would happen. No matter where I put it though, I still get that ugly bash-2.05b$ prompt every time I log in. So far I've added these PS1 lines into .bashrc, /etc/bashrc, and /etc/profile... and it hasn't made any difference with any of them. It shouldn't matter where in the file I put this line, right?
Thanks for the suggestions so far, hopefully I can get this working yet.
Hmmm, I just started bash and got the same prompt you're stuck with. When I typed "source /etc/profile" the prompt changed to my username, host and wdir, which is what I would expect from looking at /etc/profile.
So, it seems that /etc/profile isn't automatically read when you call bash.
When I put the line "source /etc/profile" into ~/.bashrc, then it works. But your problem then is how to create this file automatically for each user.
Just did some googling, and it seems bash reads /etc/profile when it's a
login shell and ~/.bashrc otherwise.
Are you testing your changes by logging completely in and out, or just by opening a new xterm? I don't know enough to know how booting into runlevel 5 will affect things. Is bash still the login shell in that case?
Hey John, thanks for all the help with this. Thus far, I've been opening new xterm windows to test for the most part, but I've also restarted a few times as well, just to make sure. I see what you mean about the source thing.. typing "source /etc/profile" gets things looking right for me too. I only need to get this working for 1 user ideally, but knowing how to do it for others would be very helpful. Does each user account have their own profile that needs to be edited?
I did add that line into the .bashrc file, and it doesn't seem to work when just opening a new xterm window. When you added it, did it start working right away? Or did you logout first? Maybe a reset is needed for it to kick in... have to give that a shot.
Also, I'm not sure yet about how bash is running when in graphic mode.
The general pattern for shells is that there's a system wide set-up file in /etc which is read first and then the shell looks in the users home directory for customisations. If some variable is set twice, the user's set-up file overrides the /etc one, simply by virtue of being read second, but if there isn't any file there, the shell doesn't care.
The /etc files save sysadmins a lot of hassle keeping everyone's profile up-to-date with any changes in the environment, etc. Then what the users do with their set-up is up to them.
That explanation makes sense, seems to allow for users to customize some of their own settings. So, when the shells look to the home directory, are they still looking for a bashrc file for the settings, or a profile? Since I haven't had any luck just adding the settings to the global config files, maybe I will have better luck with the individual users (which there aren't that many of luckily).
Edit: Nevermind, answered my own question. Created a .bashrc file in the users home directory with the line 'source /etc/profile' and things seem to be working correctly now, even tried multiple terminal apps (Gnome-terminal, xterm) and they all seem to be working right. Thanks for all the help!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.