2017-02-23

Get hostname from fully qualified domain name (FQDN)

Here’s a quick post to get the host/server name out of its fully qualified domain name (FQDN).

[mmond@centaur ~]$ cat servers.master
jupiter.nn.hosted.net
centaur.nz.hosted.net
pentana.dk.hosted.net

[mmond@centaur ~]$ cat servers.master | cut -d. -f1
jupiter
centaur
pentana
[mmond@centaur ~]$

No comments:

Post a Comment