Help - Search - Members - Calendar
Full Version: Changing Command Line Prompt....
Linuxhelp > Support > Technical Support
LinuxHatesMe
I've been noticing alot of peeps have some interesting looking command line prompts. My is the lame default, user@localhost user. What file do I edit to change this and how do I change the name of my localhost to something else?
michaelk
http://www-106.ibm.com/developerworks/linu...y/l-tip-prompt/

And then add it to your profile for bash its .bash_profile which is hidden.
Jay-Jay
Hay, i'm just following up.

If this helps could you let us know as i'm writing a PAQ's page and so I'm asking as many people as I can to write how they sovled their question and how.

Thanks

Jay-Jay
LinuxHatesMe
It sorta did. I mean, the info is there I just can't figure it out. The help page this points too makes me think that it thinks my bashrc file is gonna be plain or simple when there is already a complex code in there that determines the type of window, ie xterm ect. And is in too advanced a form for me to break it down. Perhaps when I boot back into linux I can paste my bashrc here and then the code I'm trying to implement and maybe you guys can tell me why I get what it gives me.
chrisw
try this: its on the guides page

http://www.linuxhelp.ca/guides/bashprompt/
LinuxHatesMe
First off I'd like to say that page is nice, but the problem I am having now is that I don't know where within all this code from my bashrc I should put my new prompt code... take a look at you'll see what I mean.. I am supposed to add an export code within all this junk. Where tho?


# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# by default, we want this to get set.
# Even for non-interactive, non-login shells.
if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then
umask 002
else
umask 022
fi

# are we an interactive shell?
if [ "$PS1" ]; then
case $TERM in
xterm*)
PROMPT_COMMAND='echo -ne "33]0;${USER}@${HOSTNAME}: ${PWD}07"'
;;
*)
;;
esac
[ "$PS1" = "\s-\v\$ " ] && PS1="[u@h W]\$ "

if [ -z "$loginsh" ]; then # We're not a login shell
for i in /etc/profile.d/*.sh; do
if [ -x $i ]; then
. $i
fi
done
fi
fi

unset loginsh
michaelk
Actually it says add it to your profile not bashrc file.

And I would add it to your /home/user/.bash_profile not the global files in /etc
LinuxHatesMe
Well I'm not sure what I did wrong, it said the changes would take place immediately. But I saw no changes. I had copied back over my backup file. And here is what it contains

# .bash_profile



# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME


Where in that would I place my prompt code? I tried placing it at the VERY end of the file and just after the first line. Neither worked. sad.gif
chrisw
did you logout and log back in for the changes to take place
LinuxHatesMe
Didn't know I was supposed to. smile.gif I decided to rid myself of mandrake and installed rh 9 this morning, gonna redo this, test it, and give ya guys some feedback in about an hour or so.
Hemant
simple....there should be a file called .bashrc in ur home directory....simple edit that file and at the end add following lines...

PS1="MITOCHONDRI<\w>"
export PS1

this will work certainly....

and adding these lines to the .bash_profile will be effective only when...
1.u r logged in to text mode
2.or when u use xwindow enter command . .bash_profile manualy...
Hemant
hey whether it worked or not..
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.