Linux uses the hostname command to modify the host name.
An example of modifying a hostname in Linux.
Run directly hostname can view the current host name, to view the hostname of other command parameters, run hostname-h as follows:
Usage:hostname [-v] {hostname|-f file} set hostname (from file)
DomainName [-v] {nisdomain|-f file} set NIS domainname (from File)
hostname [-v] [-d|-f|-s|-a|-i|-y|-n] Display formatted name
hostname [-v] display hostname
Hostname-v|–version|-h|–help Print info and exit
Dnsdomainname=hostname-d, {yp,nis,}domainname=hostname-y
-s,–short Short Host Name
-a,–alias alias names
-i,–ip-address addresses for the hostname
-f,–fqdn,–long long host name (FQDN)
-d,–domain DNS Domain Name
-y,–yp,–nis NIS/YP DomainName
-f,–file read hostname or NIS domainname from given file
This command can read or set the hostname or the NIS domainname. You can
Also read the DNS domain or the FQDN (fully qualified domain name).
Unless you are using bind or NIS to host lookups you can change the
FQDN (fully qualified domain name) and the DNS domain name (which is
Part of the FQDN) in the/etc/hosts file.
See the use of-V. To modify the host name command:
Hostname-v the new host name
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.