Changed hostname in Yast but not changed in bash

I used Yast to change the hostname for 127.0.0.1 and ::1 but on the bash command line, the prompt is still username@localhost which I find somewhat annoying. Is there anything I have missed? I couldn’t find anything else in Yast.

I don’t think it is a good idea to divert from the convention to have localhost for 127.0.0.1.

IMHO, when you use YaST to change the hostname (Yast > System > Network Settings and then the Hostname/DNS tab), this is not bound to 127.0.0.1, but it is just changing the host name on those places that matter. And after this is done (and at least a fresh login), your bash prompt should show the new hostname (when you did not tinker with the PROMPT value yourself).

I always have had as default prompt

henk@boven:~>

where boven is the hostname I have set at installation. Never saw the usage of localhost for this.
What shows

echo $HOST
echo $HOSTNAME

Hi
Use hostnamectl;


hostnamectl
hostnamectl set-hostname <system_name>

What exactly did you do?

It seems that there are several places where hostname is mentioned. I’m not sure which you used.

I’m guessing that you used:

Yast –> Network Services –> Hostnames

As far as I know, that just changes what is in “/etc/hosts”.

To set the machine name, I use:

Yast –> System –> Network Settings

If you are using NetworkManager, that will give you a warning (which you can ignore).

I then click on the tab “Hostname/DNS”. I enter the hostname there. It shows it as a static hostname (not tied to any IP address).

After you set that, you probably have to logout and login again (or maybe even reboot) before it shows in bash.