openSUSE and SLES will assign a random hostname to the system during installation if not manually set. The random hostname starts with linux- followed by four random alphanumeric characters.
hostname information for openSUSE and SLES is stored in /etc/hostname file as with other Linux systems. You can change the hostname for your SUSE system by editing the /etc/hostname file or by using hostnamectl program at the terminal.
Steps to change hostname in openSUSE and SLES:
- Open the Terminal application.
- Show current hostname.
user@linux-ui1m:~> hostname linux-ui1m
hostname is normally displayed in at the shell prompt via \h in the $PS1 environment variable.
- Set hostname using hostnamectl.
user@linux-ui1m:~> sudo hostnamectl set-hostname host [sudo] password for root:
- Check hostname again to confirm.
user@linux-ui1m:~> hostname host
The shell prompt is not immediately updated as $PS1 is only set when a new shell is started
- Start a new shell to test.
user@linux-ui1m:~> bash user@host:~>

Author: Mohd Shakir Zakaria
Mohd Shakir Zakaria is a skilled cloud architect with a background in development, entrepreneurship, and open-source advocacy. As the founder of Simplified Guide, he helps others understand the complexities of computing, making tech concepts accessible to all.

Mohd Shakir Zakaria is a skilled cloud architect with a background in development, entrepreneurship, and open-source advocacy. As the founder of Simplified Guide, he helps others understand the complexities of computing, making tech concepts accessible to all.
Discuss the article:
Comment anonymously. Login not required.