Staring with Fedora 18, the hostname is longer set it /etc/sysconfig/network
but in /etc/hostname
. To manipulate the hostname there’s a small tool named hostnamectl
which is part of Fedora’s systemd
package.
The following table (taken from the Fedora 18 Release Notes) shows a few basic hostnamectl
commands to set or change a host’s name:
Command | Function |
---|---|
hostnamectl set-hostname fedorasystem --pretty | Set pretty hostname. |
hostnamectl set-hostname fedorasystem.example.org --static | Set static hostname. |
hostnamectl set-hostname fedora-dhcp-client.example.org --transient | Set transient hostname. |
hostnamectl set-hostname fedorasystem.example.org | Without arguments, hostnamectl will apply to all hostname types. |
hostnamectl status | Show current hostname settings |
See also hostnamectl manpage.