Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
hostname prints the current host name. Options show the FQDN, the DNS domain or all IP addresses.
Setting a name with hostname NAME lasts only until reboot. To set it for good on RHEL, use hostnamectl set-hostname NAME (writes /etc/hostname).
Zo schrijf je het
hostname [OPTION]
hostname [-b] [-F FILE] [NAME]Opties 12
Meest gebruikt
Niets past bij dit filter.
Voorbeelden 10
$ als gewone gebruiker# als root (of met sudo)
1Show the host name
hostname server1.example.comRHEL often uses the full name as host name.
2Short name and FQDN
hostname -s; hostname -f server1 server1.example.com-f needs /etc/hosts or DNS to know the full name.
3All IP addresses
hostname -I 192.168.122.10 fe80::5054:ff:fe12:3456Quick way to find the IP of a fresh VM.
4Domain part
hostname -d example.comSame as
dnsdomainname.5Set a name until reboot
hostname test1For a quick test only.
6Set the name for good
hostnamectl set-hostname server1.example.comWrites /etc/hostname (the RHCSA way).
7Use the name in a prompt or file name
Each server makes a different file name.
8Check the name for certificates
hostname -f; getent hosts $(hostname -f)The FQDN must resolve to the server IP before you request a TLS certificate.
9Find wrong FQDN settings
hostname -f hostname: Name or service not knownAdd the name to /etc/hosts or DNS.
10Show the domain of NIS
hostname -yOnly for old NIS setups.
Niets past bij dit filter.
Bestanden
/etc/hostname- The static host name.
/etc/hosts- Local name to address list.
Exitcodes
0 :: Done. 1 :: Error.