Change hostname in debian

A better way to change the hostname in debian systems.

# hostname -f

Sanity-check the list of /etc/* files in which the hostname appears.
# cd /etc
# grep -ril `hostname -f` /etc |tee hostname.files.list
The above list seems fine but imagine what it would happen if the hostname was eth or work.

Save each file that contains the hostname to file.0 and replace geminus (old hostname) with gem (new hostname).
# perl -i.0 -p -e 's/geminus/gem/g;' `cat ./hostname.files.list`

Restart services (ssh and exim in this case) or better reboot the system if you can afford it.
# reboot

Change the hostname in debian systems