LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem with Shell-Konsole (Klauncher) (https://www.linuxquestions.org/questions/linux-newbie-8/problem-with-shell-konsole-klauncher-387859/)

gavita 11-30-2005 06:18 AM

Problem with Shell-Konsole (Klauncher)
 
Hi!

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...

Can anyone help?

Thanks a million!

nilleso 11-30-2005 07:43 AM

edit your ~/.bashrc file and add the following line:
Code:

PS1="\u@\H > "
further searching for "bash prompt" or "PS1" will offer additional info if you require

cheers:)

kilgoretrout 11-30-2005 07:47 AM

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:

http://www.linuxselfhelp.com/howtos/...t-HOWTO-2.html

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.

gavita 11-30-2005 10:26 AM

Hi there,

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?

Thanks a million again!

ethics 11-30-2005 10:28 AM

source ~/.bashrc or open a new shell

if that doesn't work add the line to /etc/.bashrc - note this controls each time a shell is opened.

~/.bash_profile handles the initial login.

gavita 11-30-2005 10:40 AM

Thanks ethics!

Just tried that solution out as well, and it hasn't changed anything. :-(

kilgoretrout 11-30-2005 10:58 AM

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:

$ PS1="\u@\H > "

If that doesn't work, we can go from there.

gavita 11-30-2005 11:45 AM

Hi kilgoretrout,

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.

Thanks once again!

ethics 11-30-2005 11:56 AM

what about adding export PATH after it to export the path (i dont have to do this on my FC 4 but i do on Debian)

Maybe konsole reads from a different file?

gavita 11-30-2005 12:09 PM

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]\$ "

export DBROOT DBWORK DBCONFIG PATH LD_LIBRARY_PATH


All times are GMT -5. The time now is 07:03 PM.