Say you want to change your computer name to be: bender.example.org
- Edit the /etc/hostname file
sudo nano /etc/hostname
There's only one line in this file, change it to the desired computer name.
In this case: "bender".
- Edit the /etc/hosts file
sudo nano /etc/hosts
Leave the first loopback (127.0.0.1) line alone, but change the second one to list both your computer name, and the fully qualified domain name (if it has one).
In this case: "127.0.0.1 bender.example.org bender"
Now you're changes will stick after a reboot, and you can still SSH into your machine. 'cause it's always embarrassing when you can't connect to the computer you just renamed...