Hostname small knowledge of the use of commands
We all know that the hostname command is to view the host name and modify the hostname.
[[email protected] ~]# hostname //view host name of native
Apache.example.com
[[email protected] ~]# hostname redhat //temporarily modify host name
[Email protected] ~]# hostname
Redhat
[[email protected] ~]# uname-n //This can also display the host name
Redhat
However, such changes are temporary, when your host restarts it will immediately disappear, with the modification of the configuration file will be edited:
# vim/etc/sysconfig/network
Let's take a look at the other parameters of hostname:
[Email protected] ~]# hostname redhat.example.com
[[email protected] ~]# hostname-s //output host name in short format
Redhat
[[email protected] ~]# hostname-a //Display host alias, if no output is empty
We all know to view the host IP using the ifconfig command, in fact hostname can also view the host IP
[[email protected] ~]# hostname-i //View host IP
192.168.1.113
[Email protected] ~]# hostname-d
example.com
We all know to check the domain name of this machine to view this configuration file:
[Email protected] ~]# cat/etc/resolv.conf
; Generated By/sbin/dhclient-script
NameServer example.com
NameServer 218.30.19.50
NameServer 61.134.1.4
Of course the hostname command is also very bull:
[[email protected] ~]# hostname-d //view native domain name
example.com
The following parameters are not commonly used.
[[email protected] ~]# hostname--yp //view is NIS/YP domain name, not set to empty
(none)