The Suse Linux hostnamectl command can be used by sysadmin to change the hostname of a SUSE Linux server/laptop/desktop. You can use the hostname command to see or set the system’s host name too. The host name or computer name is usually at system startup in /etc/hostname file. Open the terminal application and type the following command to change hostname on Suse Linux.
Display the current Suse Linux hostname
Type any one of the following command:
$ hostname
OR
$ hostnamectl
Suse Linux change hostname command
The procedure to change the computer name on Suse Linux:
- Type the following command to edit /etc/hostname using nano or vi text editor:
sudo vi /etc/hostname - Delete the old name and setup new name.
- Next Edit the /etc/hosts file:
sudo vi /etc/hosts - Replace any occurrence of the existing computer name with your new one.
- Reboot the system to changes take effect:
sudo reboot
How to change the SUSE Linux server hostname without a system restart?
Type the following commands:
$ sudo hostname new-server-name-here
Next edit the /etc/hostname file and update hostname:
$ sudo vi /etc/hostname
Finally, edit the /etc/hosts file and update the lines that reads your old-host-name:
$ sudo vi /etc/hosts
From:
127.0.1.1 old-host-name
To:
127.0.1.1 new-server-name-here
Save and close the file.
A note about hostnamectl command
Systemd based Linux distor such as SUSE Linux 12.x and above can simply use the hostnamectl command to rename hostname. To see current setting just type:
$ hostnamectl
Sample outputs:
Static hostname: linux-mig6.suse Transient hostname: linux-mig6 Icon name: computer-vm Chassis: vm Machine ID: 97b5d5396d5d1b2c11c0ea965a7456fb Boot ID: e29ed76aad154e7392fce498231c9a09 Virtualization: kvm Operating System: SUSE Linux Enterprise Server 12 SP3 CPE OS Name: cpe:/o:suse:sles:12:sp3 Kernel: Linux 4.4.103-6.38-default Architecture: x86-64
To change hostname from linux-mig6 to suse-nixcraft, enter:
$ sudo hostnamectl set-hostname suse-nixcraft
$ hostnamectl
How to assign a static hostname to a server running SuSe Linux using yast
yast is universal configuration utility for SuSe/OpenSuSe. To setup hostname run yast command:
$ sudo yast
OR
$ sudo yast2
You must use the TAB and arrow keys to navigate YaST. In YaST, navigate to System, then Network Settings, and then press the Enter key. Use the arrow keys to navigate to Hostname/DNS and use the TAB key and Shift + TAB key combination to set options:
Next set the hostname and domain name to preferred values. Use the TAB key to navigate to [ OK ] and press the Enter key to save changes. Finally, use the TAB key to navigate to [Quit] and press the Enter key to exit app.
- Ubuntu Linux Change Hostname (computer name)
- Debian Linux: Change Hostname / Computer Name Permanently
- Linux change my hostname / computer system name
- Linux Change Hostname
- RHEL / Centos Linux 7: Change and Set Hostname Command
- OpenBSD Change Hostname
- CentOS Linux 5/6 Change Hostname Command
- Linux setting hostname and domain name of my server
- FreeBSD Change Hostname without reboot
- SuSe Linux Change Hostname without reboot
- How to set the hostname on Fedora Linux
- Ubuntu 18.04 LTS change hostname permanently
- Ubuntu set hostname permanently (computer name) command
- OpenSUSE Linux set hostname permanently (computer name) command
- RHEL 8 Linux set hostname permanently (computer name) command
- CentOS 8 Linux set hostname permanently (computer name) command
- Ubuntu 20.04 LTS set hostname permanently (computer name) command
- Set / Change FQDN on Ubuntu 20.04 LTS
- Alpine Linux - Setting system hostname
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 0 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |