hostname1
Set or print the name of current host system
Usage
hostname [-f]
[{-s | -d}]
[name-of-host]
Overview
The hostname utility prints the name of the current host. The super-user can set the hostname by supplying an argument; this is usually done in the initialization script /etc/rc.d/hostname, normally run at boot time. This script uses the hostname variable in /etc/rc.conf.
Options:
-
-f -
Include domain information in the printed name. This is the default behavior.
-
-s -
Trim off any domain information from the printed name.
-
-d -
Only print domain information.
Examples
Set the host name of the machine and check the result:
$ hostname beastie.localdomain.org $ hostname beastie.localdomain.org
Do not show domain information:
$ hostname -s beastie
Show only domain information:
$ hostname -d localdomain.org
Releases
87 releases since FreeBSD 2.0.5-RELEASE; the text changed 50 times.
- 2.0.5
- 2.1.5–2.1.7.1
- 2.2.2
- 2.2.5–2.2.6
- 2.2.7–2.2.8
- 2.2.9
- 3.0–3.2
- 3.3–3.4
- 3.5–3.5.1
- 4.0–4.2
- 4.3
- 4.4–4.5
- 4.6–4.11
- 5.0–5.2.1
- 5.3–5.4
- 5.5
- 6.0–6.2
- 6.3
- 6.4
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- 8.0
- 8.1
- 8.2
- 8.3
- 8.4
- 9.0
- 9.1
- 9.2
- 9.3
- 10.0
- 10.1
- 10.2
- 10.3
- 10.4
- 11.0
- 11.1
- 11.2
- 11.3
- 11.4
- 12.0
- 12.1
- 12.2
- 12.3
- 12.4
- 13.0–13.2
- 13.3–14.5
- 15.0–16.0
-d since FreeBSD 11.1-RELEASE;
-f since FreeBSD 6.3-RELEASE.