Name
hostname
Synopsis
hostname [option
] [nameofhost
]
Set or print name of current host system. A privileged user can set the hostname with the nameofhost argument.
Mac OS X accepts the -s
option.
GNU/Linux Options
-a
,--alias
Display the alias name of the host (if used).
-d
,--domain
Print DNS domain name.
-f
,--fqdn
,--long
Print fully qualified domain name.
-F
file
,--file
file
Consult file for hostname.
-i
,--ip-address
Display the IP address(es) of the host.
-n
,--node
Display or set the DECnet node name. Not available on all systems. (And not terribly useful even on those systems that have it.)
-s
,--short
Trim domain information from the printed name.
-v
,--verbose
Verbose mode.
-y
,--yp
,--nis
Display the NIS domain name. A privileged user can set a new NIS domain name with nameofhost.
Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.