PDA

View Full Version : [root@cpe-066-026-063-173 ~]#



Exudose
29th September 2006, 08:26 AM
[root@cpe-066-026-063-173 ~]#

Is there any way i can change the cpe-066-026-063-173 to something else? When I first installed Core 5 64bit I could of swore it said something different. What does this mean [root@cpe-066-026-063-173 ~]# I know the first part is the user but after that what is it and how can I change it to something else. This might sound like a stupid nooob question that doesnt make any sence and well it is.

ppesci
29th September 2006, 09:47 AM
the strange string you see is determined by PS1 environment variable.

If you try:

echo $PS1

you will get:

[\u@\h \W]\$

That is:
\u is replaced by the user name, in your case root
@ is interpreted as literal
\h is replaced for the name of the host, you likely have dhcp and cpe-066-026-063-173 is the internet name asigned to you
\W is replaced for the working directory
[ and ] is interpreted as literal
$ is literal except when you are root, in this case is replaced by #
If you change PS1 variable, you change the string.
To see how many options you have for create your own prompt, you must to type:

man bash

and go to the PROMPTING section

HTH

Pietro Pesci Feltri

InKo
29th September 2006, 09:53 AM
or change PS1 in /etc/bashrc

Exudose
29th September 2006, 10:05 AM
Wow nice detailing.
You said I was determined by PS1 environment variable.
So bascally the thing that does not look normal is the cpe-066-026-063-173 and you said that was my host right ?
Is there anway I can edit the host name and make is say RoadRunner or something like that if so how.

InKo
29th September 2006, 10:29 AM
that is just an example (/etc/bashrc):

PS1="[\u@RoadRunner] \W $ "

set it and type at the terminal

bash to reset.

Exudose
29th September 2006, 10:30 AM
Wait walk me threw what commands to type as soon as I open a terminal window

InKo
29th September 2006, 10:38 AM
1.
su
2.
cd /etc
3.
vi bashrc (or emacs or whatever you like)
4. comment your old 'PS1=' line
5. copy your new ' PS1="[\u@RoadRunner] \W $ " ' line
6. exit of the editor
7. type at the terminal
bash

that is all! :)

Exudose
29th September 2006, 10:42 AM
Screw it I give up on changing it. I can get into the vi editer but dont know what to edit or where to edit.. Thanks for the help tho

InKo
29th September 2006, 10:50 AM
use gedit or kedit or emacs or kwrite... you have a lot of editors on linux...
:)

Exudose
29th September 2006, 10:58 AM
i know linux has alot of editers but vi is find you said
(or emacs or whatever you like)
4. comment your old 'PS1=' line
5. copy your new ' PS1="[\u@RoadRunner] \W $ " ' line
6. exit of the editor
7. type at the terminal
and part 4 and 5 confusted me i didnt see anything exactly like that in there so dont worry about it I can deal with the weird crap after the @ everytime im in a terminal

Jongi
29th September 2006, 12:26 PM
4. Put a # at the beginning of the line with PS1

5. Type PS1="[\u@RoadRunner] \W $ in an empty line

6. Save the file

7. Exit the editor you used.

ppesci
29th September 2006, 06:47 PM
Or you can modify only the .bash_profile file located in your home directory adding this 2 lines:

PS1="[\u@RoadRunner] \W $ "
export PS1

Of course, only change the prompt for this user but you don't touch general bash configuration files.

Pietro Pesci Feltri