Closed Captioning Closed captioning available on our YouTube channel

Linux tip: How to use the hostnamectl command

Network World | Feb 8, 2019

In this Linux tip, we look at the hostnamectl command. It’s a command that provides information on a particular system – including but not limited to its hostname – and even allows you to make some changes.

Copyright © 2019 IDG Communications, Inc.

Similar
Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld. In this Linux tip, we’re going to look at the hostnamectl command. It’s a command that provides information on a particular system – including but not limited to its hostname – and even allows you to make some changes.
So, let’s take a look at hostnamectl. It should provide a report that looks something like this:
As you can see, the output includes the hostname, chassis type (desktop), the OS, the kernel version and the system architecture. It also includes a couple long strings that probably mean very little to you – the machine and boot IDs. The machine ID is set up when the system is installed. The boot ID is set whenever the system boots.
You can change the hostname using the hostnamectl command, though you have to be set up with root privileges and supply your password. You’ll see something like this:
Notice that you have to select your identity from a list of privileged accounts (if there is more than one) and provide your password.
You can also use the hostnamectl command to add a field describing the system’s deployment (e.g., development or production) or one that describes a system’s location.
If you want to remove the new fields, enter the same commands with an empty string in place of the values previously specified. Run the hostnamectl command again and you’ll see that these fields are no longer set. That’s your Linux tip for today. If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.

Featured videos from IDG.tv