LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 11-30-2005, 06:18 AM   #1
gavita
LQ Newbie
 
Registered: Jun 2004
Posts: 24

Rep: Reputation: 15
Unhappy 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!
 
Old 11-30-2005, 07:43 AM   #2
nilleso
Member
 
Registered: Nov 2004
Location: ON, CANADA
Distribution: ubuntu, RHAS, and other unmentionables
Posts: 372

Rep: Reputation: 31
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
 
Old 11-30-2005, 07:47 AM   #3
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,989

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
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.
 
Old 11-30-2005, 10:26 AM   #4
gavita
LQ Newbie
 
Registered: Jun 2004
Posts: 24

Original Poster
Rep: Reputation: 15
Unhappy

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!
 
Old 11-30-2005, 10:28 AM   #5
ethics
Senior Member
 
Registered: Apr 2005
Location: London
Distribution: Arch - Latest
Posts: 1,522

Rep: Reputation: 45
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.
 
Old 11-30-2005, 10:40 AM   #6
gavita
LQ Newbie
 
Registered: Jun 2004
Posts: 24

Original Poster
Rep: Reputation: 15
Thanks ethics!

Just tried that solution out as well, and it hasn't changed anything. :-(
 
Old 11-30-2005, 10:58 AM   #7
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,989

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
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.
 
Old 11-30-2005, 11:45 AM   #8
gavita
LQ Newbie
 
Registered: Jun 2004
Posts: 24

Original Poster
Rep: Reputation: 15
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!
 
Old 11-30-2005, 11:56 AM   #9
ethics
Senior Member
 
Registered: Apr 2005
Location: London
Distribution: Arch - Latest
Posts: 1,522

Rep: Reputation: 45
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?
 
Old 11-30-2005, 12:09 PM   #10
gavita
LQ Newbie
 
Registered: Jun 2004
Posts: 24

Original Poster
Rep: Reputation: 15
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
executing konsole from shell script Meriadoc Linux - Newbie 10 07-10-2009 08:08 AM
Editing text file in Shell - Konsole (SuSE 9.1) Ree Linux - Newbie 5 10-03-2004 11:48 AM
Setting PS1 variable for KDE Konsole shell (RH9) robertmarkbram Linux - Software 4 10-14-2003 07:38 PM
Problem with mandrake's konsole shell...Plz HELP madiyaan Linux - Newbie 5 05-11-2003 08:30 PM
HELP! klauncher failing... lhoff Linux - Software 1 05-17-2002 08:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration