set hostname linux command code example Example: linux change hostname sudo nano /etc/hostname sudo nano /etc/hosts sudo reboot