I have an Ubuntu Server on version Ubuntu 22.04 LTS and I'm confused about the following. Usually in the terminal it's like that: user@nameofdevice:~$
but for any reason it's now user@mail:~$
and I don't know why and what it means.
Linux – Understanding user@mail:~$ in Terminal
linuxterminalUbuntu
Best Answer
the contents of /etc/hostname have somehow been changed. let's assume you're using mail.domain.com and it's made the "pretty" hostname mail.
to fix this you want to utilize
hostnamectl
, which, if you type the command by it's self it will output what everything is currently set to.to proceed to change the hostname run
sudo hostnamectl set-hostname "hostname.example.com"
to change the "pretty" hostname you can apply the --pretty flag to the command and run
sudo hostnamectl set-hostname --pretty "hostname"