Updated: 22 October 2026 · Applies to: SUSE Linux / openSUSE

Show the current hostname

hostname

or:

hostnamectl

Change the hostname without restarting

sudo hostname new-server-name-here

Then edit /etc/hostname and update it to the new name:

sudo vi /etc/hostname

Then edit /etc/hosts and update the line that has your old hostname:

sudo vi /etc/hosts

Change a line like:

127.0.1.1 old-host-name

to:

127.0.1.1 new-server-name-here

Save and close the file.

Using hostnamectl on systemd-based SUSE (12 and later)

SUSE 12 and later use systemd, so you can rename the host in one step. Check the current setting:

hostnamectl

Set a new hostname, for example from old-host to new-host:

sudo hostnamectl set-hostname new-host
hostnamectl

Setting a static hostname with YaST

YaST is SUSE/openSUSE's configuration utility. To set the hostname through it:

sudo yast

or, for the newer interface:

sudo yast2

Navigate with Tab and the arrow keys: go to System, then Network Settings, press Enter, then use the arrow keys to reach Hostname/DNS. Use Tab and Shift+Tab to move between fields, set the hostname and domain name, Tab to OK and press Enter to save, then Tab to Quit and press Enter to exit.

The command-line methods above take effect without touching YaST at all, which is usually faster for a one-off rename; use YaST itself when you want to change other network settings (such as the domain name or DNS servers) in the same session.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket