From the course: Linux System Engineer: Networking and SSH

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Change hostname

Change hostname

From the course: Linux System Engineer: Networking and SSH

Start my 1-month free trial

Change hostname

- [Instructor] In older versions of Enterprise Linux the host name was stored in slash etc slash sysconfig slash network. This was a very Red Hat-specific place to put it as other distributions used slash etc slash hostname. Now on System D, the host name is stored in slash etc slash hostname, making it more consistent between versions of Linux. However, changing it manually with a text editor is not recommended, as the system doesn't notice automatically. We can change the host name several ways, but the simplest may be with the hostnamectl command. Let's start by checking the default output. In a terminal, type in hostnamectl and hit Enter. This shows the static host name as well as other bits of data. I'm logged into my rhhost1vm, but my host name is still localhost.localdomain. To change the host name, we provide the set dash hostname option. We'll also need to elevate privileges with sudo. Type in clear, and then type in sudo space hostnamectl space set dash hostname space…

Contents