$hostname linux code example
Example 1: how to get hostname on linux
$ hostnamectl
Example 2: linux change hostname
sudo nano /etc/hostname
sudo nano /etc/hosts
sudo reboot
$ hostnamectl
sudo nano /etc/hostname
sudo nano /etc/hosts
sudo reboot