linux change hostname command code example
Example 1: centos change hostname
# hostnamectl set-hostname your-new-hostname
Example 2: linux change hostname
sudo nano /etc/hostname
sudo nano /etc/hosts
sudo reboot
# hostnamectl set-hostname your-new-hostname
sudo nano /etc/hostname
sudo nano /etc/hosts
sudo reboot