HOWTO: change hostname and reload it without reboot on CentOS 8 stream

Well another mini-post that goes back in time because I’m still willing to write something meaningful today. But this bit can’t be forgotten.

Problem: I have one computer that doesn’t report its name as I want. For example,

#> hostname
mycomputer.domain.org

Solution: We edit /etc/hostname and reload it using the old system tool. In brief:

#> more /etc/hostname
mycomputer.domain.org
# edit the file, change it to mycomputer
#> more /etc/hostname
mycomputer
#> hostname
mycomputer.domain.org
# now we force the hostname to be reloaded
#> hostname -F /etc/hostname
#> hostname
mycomputer

There you go. That’s it. Back in time with it!

Leave a comment