-   Fedora (
-   -   How to change hostname on shell [user@tochange] (

guarriman 01-12-2007 03:00 AM

How to change hostname on shell [user@tochange]

I'm using Fedora Core 2, and would like to change the hostname
on my shell:
(I'd like to change from pc04 to pc-john)

I've been investigating, and I could edit these files:

Is this the way or must I change other parameters?

Thank you very much,

reddazz 01-12-2007 03:01 AM

Thats the right way to do it.

koca 01-15-2007 12:04 AM

it depends what you want exactly. If you want change hostname too, you can change it +- how you describe. But if you want change just hostname on shell, you can modify variable $PS1 which is your variable shell prompt which is displayed.
if you want to have this one :
you set $PS1 variable as : export PS1="[\u@pc04]#" - you can try to run this command under shell console to see what happened. If you want set up it permanently when you logon, just append it to your .bashrc or .bash_profile or .profile file (it depend on shell when you are using).
Here you are some other possibilities for change PS1:
# \t - time
# \d - date
# \n - newline
# \s - Shell name
# \W - The current working directory
# \w - The full path of the current working directory.
# \u - The user name
# \h - Hostname
# \# - The command number of this command.
# \! - The history number of the current command

All times are GMT -5. The time now is 09:10 PM.