Ask Your Question

When changing hostname should I also make changes /etc/hosts?

asked 2014-09-16 09:47:17 -0500


Fedora comes with a hostname which is typically also available in /etc/hosts but when you change hostname using hostnamectl set-hostname it changes the hostname but doesn't add it to /etc/hosts. I was wondering if that should be done.

Make it look like following.

$ cat /etc/hostname
$ cat /etc/hosts               localhost.localdomain localhost
::1                     localhost6.localdomain6 localhost6


$ cat /etc/hostname
$ cat /etc/hosts               fedora localhost
::1                     fedora6 localhost6
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-09-16 10:08:58 -0500

mether gravatar image

hostnamectl does not update /etc/hosts but you can add the name manually there if needed. Usually /etc/hosts is only updated to give aliases to other hosts you connect to and it is not required to be updated just to change the local hostname.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-09-16 09:47:17 -0500

Seen: 1,500 times

Last updated: Sep 16 '14