<linux system hostname Command detailed >

Source: Internet
Author: User
Tags nameserver

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)

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.