LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 01-12-2007, 03:00 AM   #1
guarriman
Member
 
Registered: Nov 2004
Posts: 101

Rep: Reputation: 15
How to change hostname on shell [user@tochange]


Hi.

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

I've been investigating, and I could edit these files:
/etc/sysconfig/network
/etc/hosts

Is this the way or must I change other parameters?

Thank you very much,
 
Old 01-12-2007, 03:01 AM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

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

Rep: Reputation: 0
hi,
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.
Ie:
if you want to have this one :
[user@pc04]#
instead
[user@hostname]#
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
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 01:10 AM.

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