Linux - change the hostname in the CLI

user1984646 picture user1984646 · Jan 31, 2013 · Viewed 10.7k times · Source

I don't know how to search for this and that is why I asked for it (all my searches did not reveal any relevant information).

I have a Fedora 18 server that looks like this:

[root@dhcp-192-168-5-100 ~]#

I want to change that to:

[root@server1 ~]#

Currently, this machine is set to get IP through DHCP, but that is not the IP address of the machine and that is why I need to change the CLI to something more relevant.

Thank you

Answer

Joe T picture Joe T · Jan 31, 2013

you can type "hostname HOSTNAME" where HOSTNAME is the new name you want. The next time you log in / connect via ssh, that's what you'll see.