Generate commands to change a hostname without rebooting. Run the block that matches the machine.
hostnamectl./etc/sysconfig/network. Alpine writes /etc/hostname.scutil. FreeBSD uses sysrc. Windows uses Rename-Computer.Each Linux block also adds the name to /etc/hosts. A cloud image can put the old name back on the next boot unless preserve_hostname is true.