Click to See Complete Forum and Search --> : ok, im an idiot..bash question naming
gnuoob
09-18-2003, 06:56 PM
but since i dont know the name of it its kind of hard to look up :p
how do i change this long code to something else?
[dave@x1-6-00-20-78-07-9e-fa dave]$
the x1-6-00-20.....to "my left foot" or something
the hardest part of linux is knowing what your asking :(
looking it up is not an issues its knowing what you need to look up that sucks.
BASH PROMPT
sasKuatch
09-18-2003, 07:06 PM
Somewhere, there exists a Bash Howto, which goes into detail on configuring your bash shell (including the prompt).
gnuoob
09-18-2003, 07:10 PM
cool, now for the easy part :p
thanks :)
gnuoob
09-18-2003, 09:42 PM
i just went to http://www.tldp.org/ and tried to find something to change my bash name and cant seem to figure it out
went to
http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Bash-Prompt-HOWTO.html
and cant find out how to change
[dave@x1-6-00-20-78-07-9e-fa dave]$
to something like...
[dave@HAPPY_NEW_NAME dave]$
argh :p
kshim5
09-18-2003, 10:19 PM
try the PS1 command if you want to change the promp.
example : PS1="\u@\h \W> "
http://www.linuxgeek.net/beginners/node223.html
That's the hostname.
Edit your /etc/HOSTNAME file to change it.
Btw, what distro are you using? Sometimes this is distro-specific.
gnuoob
09-19-2003, 12:06 AM
sorry, its red9 :)
should have stated that but i forgot that peice of info
under etc/ i have
etc/host.conf &
etc/hosts
no etc/HOSTNAME
neither of the two have anything that looks like my jumble that im trying to fix
ok i looked at the page that kshim5 showed me but i cant figure out how to edit it ???
[dave@x1-6-00-20-78-07-9e-fa dave]$ ps1
bash: ps1: command not found
[dave@x1-6-00-20-78-07-9e-fa dave]$ PS1
bash: PS1: command not found
[dave@x1-6-00-20-78-07-9e-fa dave]$ PS1 \h
bash: PS1: command not found
[dave@x1-6-00-20-78-07-9e-fa dave]$ PS1\h
bash: PS1h: command not found
[dave@x1-6-00-20-78-07-9e-fa dave]$
sharth
09-19-2003, 12:40 AM
try the program hostname, or try this...
echo "what you want it to be" >> /etc/hostname
CMonster
09-19-2003, 02:16 AM
I think you can also used RH9s nice little network gui applet to change the host name.
roamingnomad
09-19-2003, 02:30 AM
Your PS1 variable is declared at the start of each Bash session in your .bashrc file, so edit that. Look for the line that says "PS1=yaddayadda".
andycrofts
09-19-2003, 02:31 AM
..it seems that you want to change the prompt, rather than your hostname.
For instance, to include the DATE before the "$".
OK, firstly, "PS1", which is a command prompt ENVIRONMENT VARIABLE - not a command, can be expanded by:
echo $PS1
Thus, you'll get (actual output on my machine)
[root@madetoja root]# echo $PS1
[\u@\h \W]\$
[root@madetoja root]#
Now, if I set this environment variable by typing the following, I get (again, actual output)
[root@madetoja root]# PS1="\d \$"
Fri Sep 19 $
Similarly, changing PS1 thus:-
PS1="Hello Andy, today's date is \d\$"
Hello Andy, today's date is Fri Sep 19$
The link in kshim5's post will let you undo the mess when you're bored with it! :D
-Cheers
-Andy
<edit> I made a bludner, by the way. Useful exercise - experiment to find out why the root prompt changed to a $ ;) (Don't tell him, folks!) </edit>
mdwatts
09-19-2003, 12:54 PM
Originally posted by andycrofts
..it seems that you want to change the prompt, rather than your hostname.
Agreed as changing the hostname might affect your internet connection since your isp may require you to use the hostname assigned.
mdwatts
09-19-2003, 12:55 PM
Why are there two separate threads on the same question?
I've merged the other into this one.
CMonster
09-19-2003, 05:36 PM
<curses the back button>
CMonster
09-19-2003, 06:00 PM
and cant find out how to change
[dave@x1-6-00-20-78-07-9e-fa dave]$
to something like...
[dave@HAPPY_NEW_NAME dave]$
I only touched on the hostname thing because in the examples he gave it was the host name he was trying to change.
otherwise, I think edit /etc/bash.bashrc can also change default prompt for all users
like
PS1="Hello \u, today is \d>" or something like that -been a while since I dabbled in customizing the prompt..