There are a few ways that the hostname can be modified from the command line. The first method is using cPanel's API:
whmapi1 sethostname hostname=hostname.domain.tld
Please remember that the hostname (here hostname.domain.tld) needs to be an FQDN.
Alternatively, there are other methods that the hostname can be changed using Linux's native utilities like the hostname command:
Or by modifying the content of network-related files such as these: (Not recommended)
Additionally, for systems that are utilizing systemd as the service manager, the hostnamectl command can be used as an alternative:
hostnamectl set-hostname hostname.domain.tld
To see how to modify the hostname from the WHM interface you can visit this link: