Network-commands/hostname
Jump to navigation
Jump to search
You might also see: host and /etc/hosts file
Description
Hostname command is used to view or define a host name and domain.
Usage
hostname [-d] [--domain] [-F filename] [--file filename] [-f] [--fqdn] [-h] [--help] [--long] [-s] [--short] [-v] [--version] [name] dnsdomainname
Options
- -a, --alias
- Display the alias name of the host (if used).
- -d, --domain
- Display NIS domain name.
- -F, --file filename
- Reads host name from provided file (lines beginning with # are considered as comments).
- -f, --fqdn, --long
- Display Full Qualified Domain Name (FQDN). A FQDN is composed of short hostname and a DNS domain name. Excepted if bind or NIS is used for host lookup, you can change FQDN and DNS domain name (included in FQDN) in /etc/hosts file.
- -h, --help
- Display help and exit.
- -i, --ip-address
- Display the IP address(es) of the host.
- -s, --short
- Display short host name.
- -v, --version
- Display version information and exit.
Example
$ hostname aldlin1
$ hostname --fqdn aldlin1.aldeid.com