Change the hostname on a running system
On any Linux system you can change its hostname with the command ‘hostname‘ (surprised?)… Here are some quick usages of the command line hostname:
hostname
Without any parameter it will output the current hostname of the system.
hostname --fqd
It will output the fully qualified domain name (or FQDN) of the system.
hostname NEW_NAME
Will set the hostname of the system to NEW_NAME. This is active right away and will remain like that until the system will be rebooted (because at system boot it will set this from some particular file configurations - see bellow how to set this permanently). You will most probably need to exit the current shell in order to see the change in your shell prompt.