Hello,
I just changed my router, and I have now my router’s name as hostname. After a reboot, still there, and I don’t know how to change it.
Here is my prompt:
me@Centro_grande:~>
hostname
Centro_grande
cat /etc/HOSTNAME
linux-e0xk.site
I don’t understand why the hostname command don’t print the value who is in the /etc/hostname file.
I’ve add a pretty hostname to test, like that:
hostnamectl set-hostname --pretty linux
hostnamectl status
Static hostname: linux-e0xk.site
Transient hostname: Centro_grande
Pretty hostname: linux
Icon name: computer-desktop
(...)
echo $PS1
\$(ppwd)\]\u@\h:\w>
If I read the man page for hostnamectl, I found that:
This tool distinguishes three different host names: the high-level "pretty" hostname which might include all kinds of special characters (e.g. "Lennart's Laptop"), the static hostname which is used to initialize the kernel hostname at boot (e.g. "lennarts-laptop"), and the transient hostname which might be assigned temporarily due to network configuration and might revert back to the static hostname if network connectivity is lost and is only temporarily written to the kernel hostname (e.g. "dhcp-47-11").
So my hostname may change if my router is on or off. This is why I don’t want to change static and transient hostname. I just want to use the pretty one in my prompt.
If someone knows, I’ll be happy! If not, I’ll just change the PS1 value.
Thank you.