In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This "Linux system how to view hostname" article, the article sample code introduction is very detailed, with a certain reference value, interested friends must refer to, for the "Linux system how to view hostname", Xiaobian sorted out the following knowledge points, please follow the pace of the editor step by step slowly understand, then let us enter the topic.
Introduction to Linux system hostname:
Whether on the local area network or INTERNET, each host has an IP address to distinguish between this host and the other host, that is to say, the IP address is the house number of the host. But the IP address is not easy to remember, so there is a domain name. Domain names only exist in the public network (INtERNET) (except for experimental local area networks for experimental purposes). Each domain name corresponds to an IP address, but an IP address can have multiple domain names. Domain name type Linuxsir.org
What is the hostname used for? In a local area network, each machine has a host name, which is used to distinguish between hosts and hosts, so you can set the host name for each machine so that you can access each other in an easy-to-remember way. For example, we can name each machine according to its function in the local area network.
Linux system hostname hostname configuration file / etc/hosts:
Fedora/Redhat or Fedora/Redhat-based packaged distribution, hostname configuration file is / etc/hosts Debian or Debian-based packaged distribution, hostname configuration files are / etc/Linux hostname and / etc/hosts Slackware hostname configuration file is / etc/hosts
Linux system hostna look at the method:
Root@apache ~] # hostname / / View the hostname of this machine
Apache.example.com
[root@apache ~] # hostname redhat / / temporarily modify the hostname
[root@apache ~] # hostname
Redhat
[root@apache ~] # uname-n / / this also displays the hostname
Redhat
However, such changes are temporary. When your host is rebooted, it will disappear immediately, and you need to edit the configuration file with the changes:
# vim / etc/sysconfig/network
Let's look at the other parameters of hostname:
[root@apache ~] # hostname redhat.example.com
[root@apache ~] # hostname-s / / output hostname in short format
Redhat
[root@apache ~] # hostname-a / / shows the alias of the host, if no output is left empty
We all know that the ifconfig command is used to view the ip of the host, but hostname can also view the ip of the host.
[root@apache ~] # hostname-I / / View host ip
192.168.1.113
[root@apache ~] # hostname-d
Example.com
We all know to check the local domain name to view this configuration file:
[root@apache ~] # 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 powerful:
[root@apache] # hostname-d / / View the native domain name
Example.com
The following parameter is not commonly used.
[root@apache ~] # hostname-yp / / View is the NIS/YP domain name, not set to empty
(none)
What are the versions of Linux? the versions of Linux are Deepin, UbuntuKylin, Manjaro, LinuxMint, Ubuntu and so on. Among them, Deepin is one of the best-developed Linux distributions in China; UbuntuKylin is a derivative release based on Ubuntu; Manjaro is a Linux release based on Arch; LinuxMint's default Cinnamon desktop is similar to Windows XP's easy-to-use; Ubuntu is the Linux operating system based on desktop applications.
The above is all the contents of the article "how to View hostname in Linux system". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.