On Debian, the hostname is set at startup thanks to the script /etc/init.d/hostname.sh which uses the file /etc/hostname. We can use this file to update the computer hostname and its FQDN (fully qualified domain name).
Caution: in the /etc/hosts file, the hostname and FQDN order must be respected.
~$ echo "my-computer" > /etc/hostname
~$ echo "127.0.0.1 my-computer.my-domain.ext my-computer localhost" > /etc/hosts
You can check the change with the following lines:
~$ hostname --fqdn
The old hostname may still be present in the command line prompt. Just logoff then login to make it dissapear .