[GTALUG] overengineering: hostnamectl

Lennart Sorensen lsorense at csclub.uwaterloo.ca
Mon Aug 29 10:02:25 EDT 2016


On Sun, Aug 28, 2016 at 09:41:24PM -0400, D. Hugh Redelmeier via talk wrote:
> How do you set the hostname of a Linux machine?  It used to be you just 
> put it in the file /etc/hostname.
> 
> Now, at least on CentOS, the SystemD way is to use the hostnamectl
> command.  There are other ways (GUI and TUI) but I think hostnamectl
> is the real way.
> 
> This lets you set the real, pretty, and transient name of the host.  I
> didn't know those existed.  In fact, there are lots of other options.
> 
> The text space of the hostnamectld is 272K (40% larger than the text
> editor I use and 2.5 times the size of the hostname command).
> 
> You can even change the hostname of other machines and hostnamectl
> will use ssh to accomplish this.  I don't see why it is hostnamectl's
> job to know how to ssh.

Well given systemd has a lot of container and VM support, having a
command that supports controlling those thigns the same as the other
systemd tools can do makes sense.  It also does a lot more than just the
hostname, including setting system type, some kind of deployment options
(sounds like container/vm stuff again), and other things.

So as a replacement for hostname, it is large and overkill, but given
that's a tiny part of what it does, it isn't quite that crazy.

-- 
Len Sorensen


More information about the talk mailing list