This quick tutorial is going to show you how to change the computer name or hostname in Ubuntu 17.04 Zesty Zapus.
While installing Ubuntu Desktop, there’s a step to create user and setup computer name in the install wizard. If you want to change this name later, follow the steps below one by one:
To change Hostname temporarily:
Open terminal by pressing Ctrl+Alt+T or searching for “Terminal” from start menu. When it opens run command:
sudo hostname NEW_NAME_HERE
Type in your password (no visual feedback due to security reason) and hit Enter.
The command in following picture sets hostname to ubuntu1704-desktop temporarily until next reboot.
Change Hostname permanently:
To permanently change your computer name, edit both /etc/hosts and /etc/hostname files via following steps:
1. Open terminal and run command to install gksu if not installed:
sudo apt install gksu
2. Edit the /etc/hosts file via command:
gksudo gedit /etc/hosts
3. Edit the /etc/hostname file via command:
gksudo gedit /etc/hostname
NOTE: In both step 2 and step 3, change the name marked via red box to a NEW hostname.
4. After saving the changes, restart your computer to apply changes.