You Got A Question? Ask    GNOME Community!

gtk-theme2
 13949   |  Oct 25
gtk_logo2
 9773   |  Mar 17
 9440   |  Aug 25
arch
 8749   |  Mar 28

How to change hostname in Gnome

This post was made with an older stylesheet


In Linux for every setting there is a configuration text file (Arch users know this better), and sometimes there is also a command that alters this file directly without needing to edit with a text-editor. For example if we want to change our hostname the file we need to edit will be somewhere like /etc/hostname or /etc/sysconfig/network etc.

We can also use some commands like hostname or sysctl kernel.hostname etc. to change our hostname. But do we have to dig so much for something so simple? After all we *just* need to change my computer name!

In Gnome 3, things are simpler :)

You can change your hostname in Settings->Details. Changes will be applied after rebooting your system. We can apply changes without reboot

sudo hostname <your hostname> (this will be lost after rebooting!)

There are many tips how to change your computer name -depending your distro- and you can discover everything by googling :)

Note that in GCC I set <pretty name> which automatically translated into my <static name> as you can see on terminal. So my pretty name is <my fedy!> where my static name is <my-fedy>.

A couple of notes on the semantics:

The static (configured) host name is the one configured in /etc/hostname or a similar file. It is chosen by the local user. It is not always in sync with the current host name as returned by the gethostname() system call. If no host name is configured this property will be the empty string. Setting this property to the empty string will remove /etc/hostname. This hostname should be an internet-style hostname, 7bit ASCII, no special chars/spaces, lower case.

The transient (dynamic) host name is the one configured via the kernel’s sethostbyname(). It can be different from the static hostname in case DHCP or mDNS have been configured to change the name based on network information. This property is never empty. If no host name is set this will default to “localhost”. Setting this property to the empty string will reset the dynamic hostname to the static host name. If no static host name is configured the dynamic host name will be reset to “localhost”. This hostname should be an internet-style hostname, 7bit ASCII, no special chars/spaces, lower case.

The pretty host name is a free-form UTF8 host name for presentation to the user. UIs should ensure that the pretty hostname and the static hostname stay in sync. i.e. when the former is “Lennart’s Computer” the latter should be “lennarts-computer”. If no pretty host name is set this setting will be the empty string. Applications should then find a suitable fallback, such as the dynamic hostname.

The icon name is a name following the XDG icon naming spec. If not set information such as SMBIOS/DMI are used to find a suitable fallback icon name (i.e. “computer-laptop” vs. “computer-desktop” is picked based on the chassis information). If no such data is available returns the empty string. In that case an application should fall back to a replacement icon, for example “computer”. If this property is set to the empty string this automatic fallback name selection is enabled again.

Learn more @ http://www.freedesktop.org/wiki/Software/systemd/hostnamed

You can see your hostname by typing <hostnamectl>


Gnome Control Center

Bastien Nocera commited a patch in GCC that sets the transient hostname alongside with static.


 
  We can't watch comments unless G+ provides an API or if you send a notification, e.g +World Of Gnome
     Sometimes is better to place your questions on GNOME Community
  • http://arsvirilis.blogspot.it/ Edoardo Maria Elidoro

    There’s a typo, it’s “hostnamectl” :)
    Keep up with the good work!