Changing the hostname in Kali Linux is very simple!
This is how Linux displays your username and hostname:
[username]@[hostname] ex: kali@kali
There are two files you need to touch in order to change your hostname:
1) Edit the ‘hostname’ file:
kali@kali:~$ sudo nano /etc/hostname
Delete the current host and add your hostname
2) Edit the ‘hosts’ file:
kali@kali:~$ sudo nano /etc/hosts
Add the hostname after localhost with a tab. Example
127.0.0.1 localhost kali
Now check to make sure everything is working well and restart
That’s it. Enjoy!