LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Changing "hostname" without re-login or reboot (https://www.linuxquestions.org/questions/linux-software-2/changing-hostname-without-re-login-or-reboot-407098/)

srns 01-23-2006 04:59 PM

Changing "hostname" without re-login or reboot
 
Guys,

How do I change the hostname without logout and a re-login?
I know if I call "hostname new_name", it gets updated..

Is there a way to reflect this on the screen immediately?

Thanks..

Centinul 01-23-2006 10:37 PM

running

Code:

uname -n
will return the hostname of your system. This is a quick and fast way to see if it has changed. Hope this helps. I'm not sure this is the answer to the question you are asking though.

srns 01-24-2006 11:21 AM

If you just enter, "hostname" (without quotes), it will return the latest hostname..

Although it wasn't what I was looking for, thanks for your reply ;-)

Centinul 01-24-2006 11:27 AM

Just out of curiousity what do you mean by "reflect this on the screen immediately"?

srns 01-24-2006 04:14 PM

OK..

old_name# hostname
old_name

old_name# hostname new_name

old_name# hostname
new_name

My original hostname is "old_name", and I modify it to "new_name" as in the 2nd command. Now, even though the hostname is "new_name", the prompt still says "old_name". (It becomes "new_name" after a re-login). But, I want it to become "new_name" immediately without a re-login.

Sorry for the confusion - I hope I'm clear ..


All times are GMT -5. The time now is 06:15 PM.