Go Job Hunting at the LQ Job Marketplace
Go Back > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Fedora This forum is for the discussion of the Fedora Project.


  Search this Thread
Old 01-12-2007, 04:00 AM   #1
Registered: Nov 2004
Posts: 101

Rep: Reputation: 15
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,
Old 01-12-2007, 04:01 AM   #2
LQ Guru
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 74
Thats the right way to do it.
Old 01-15-2007, 01:04 AM   #3
LQ Newbie
Registered: Jan 2007
Posts: 5

Rep: Reputation: 0
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Can my shell script change the password of user ? prabhatsoni Linux - Software 1 05-27-2006 03:06 AM
Postfix unable to deliver mail because user@virtualdomain becomes user@hostname azrael808 Linux - Networking 0 04-29-2006 01:35 PM
How to change user shell - Mandrake 10.1 Community Dcrusoe Mandriva 13 11-23-2004 02:42 PM
How to change hostname blackbart Linux - Newbie 2 02-01-2004 03:56 PM
Hostname change AttOMIXT Linux - Newbie 2 11-02-2003 12:10 AM

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

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