linux how to change hostname

Answer

Hostname identify computer on the network and it is visible in the terminal. We set up hostname during installation operating system, but sometimes we want to change it.

Use command "hostname" to change hostname:

hostname new_hostname

Will set the hostname of the system to new_hostname. Open new terminal to verify change hostname.

If you want to change hostname permanent use command "sysctl kernel.hostname" to change it:

sysctl kernel.hostname=NewHostname

Output: kernel.hostname = Newhostname

Command hostname without any parameter prints the current hostname of the system.

Was this information helpful to you? You have the power to keep it alive.
Each donated € will be spent on running and expanding this page about UNIX Shell.