Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
I recently noticed that my Shell-Konsole (using Klauncher, RH9), no longer shows the username@computer_name. It now shows bash-2.05b$. this is really bugging me and I have spent hours on the internet searching for some answers, but can't find any...
The bash prompt is controlled by the PS1 variable in one of several bash config scripts. Here's a good article discussing how to go about changing the prompt to your liking:
This variable is probably set in /etc/bashrc rather than ~.bashrc. The former sets the bash configuration for all users globally while the latter makes changes only for the individual user. It's unlikely that either of these files was spontaneously edited so unless you have been fooling around with these files, my guess is that something changed in your /etc/hosts file. That's where the "computer name" is picked up. Check this file; it should minimally look like:
Code:
127.0.0.1 localhost
Instead of "local host" your computer name should be listed for 127.0.0.1. If there are other computers on your network, they may also be listed here with there IP address and name but you should always have something there for 127.0.0.1 which is your local machine. My best guess is that this file was modified in some way and your bash configuration is falling back to a default prompt because it cannot pick up your computer name from /etc/hosts.
Thanks for the help. I tedited the ~/.bashrc files and the "PS1="\u@\h \W> "" only seems to show up when I log in as root. If I am not root, the console is still showing bash-2.05b$. I have also checked the /etc/hosts file (recommended by kilgoretrout) and it seems to be fine. Any other solutions?
IIRC you have to reboot for the changes in the bash config files to take effect. There are probably other ways but rebooting works for sure; the changes will not take effect instantaneosly. You should be able to change things immediately for a given session by opening konsole and running:
I edited the ~/.bachrc file by including the line PS1="[\u@\h]\$ ", then re-started and saw no difference. However, when I open the konsole and run $ PS1="\u@\H > ", I do see the change immediately.
This is what my .bashrc looks like. It does have export PATH.
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# by Sun Microsystems setup
DBROOT=/usr/local/bin/adabas
DBWORK=/usr/local/bin/adabas/sql
DBCONFIG=/usr/local/bin/adabas/sql
PATH=$DBROOT/bin:$DBROOT/pgm:$PATH
LD_LIBRARY_PATH=$DBROOT/lib:$LD_LIBRARY_PATH
PS1="[\u@\h]\$ "
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.