Yandex
Update cookies preferences

How to Set or Change System Hostname in Linux

Newer version of different Linux distributions such as latest Ubuntu, Debian, CentOS, Fedora, RedHat, etc. comes with systemd, a system and service manager that provides a hostnamectl command to manage hostnames in Linux.
 
To set system hostname on SystemD based distributions, we will use hostnamectl command as shown:
hostnamectl set-hostname new_hostname.comFor Older Linux distributions, which uses SysVinit in short init, can have their hostnames changed by simply editing the hostname file located in:
nano /etc/hostnameFor example:
1.2.3.4 new_hostname.com
On RHEL/CentOS based systems that use init, the hostname is changed by modifying:
nano /etc/sysconfig/networkFor example:
HOSTNAME="new_hostname.com"
You can check the hostname using the next command:
hostname
28 Apr 2024, 14:19:53

VPS in Bulgaria

Browse Configurations

VPS in the Netherlands

Browse Configurations

Windows Storage VPS

Browse Configurations