In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will show you how the Linux system displays and modifies the host name. The content of the article is good. Now I would like to share it with you. Friends who feel in need can understand it. I hope it will be helpful to you. Let's read it along with the editor's ideas.
Everyone has a name, and the computer also has its own command, that is, hostname,hostname is used to display the DNS name of the system and the hostname or NIS domain name used to display and set it.
How to display hostnamehostname is a pre-installation command for each linux distribution. You can display the hostname of your machine by typing hostname in the console. Here is a simple command and its output.
The command above $hostname ubuntu will tell you that the computer's name is ubuntu.
How to set hostnameHostname is set when you install Linux for the first time. One of the steps, Linux, will let you enter information about the host name. However, you can set it later if you like.
To set up your hostname, you can use the following command:
# hostname dev-machine $hostname dev-machine you need to use root permissions, or the same permissions as root, to set / modify the hostname of your computer. The "#" logo proves that you are a root user. The above command sets the hostname of your computer to dev-machine. If you haven't received any error messages, then your hostname has changed. Use the hostname command again to check and see the results.
Using the hostname command to set your hostname is not permanent. When you restart your computer, your settings will become invalid. In order to change permanently, you must manually modify the hostname configuration file.
Linux of Debian / Ubuntu system
You can find this file in the / etc/hostname and / etc/hosts folders
Here are the contents of each file
/ etc/hostname
# vi / etc/hostname dev-machine/etc/hosts
# vi / etc/hosts 127.0.0.1 localhost 127.0.0.1 dev-machine you will find that it takes effect immediately without restarting your linux.
Linux of RedHat / CentOS system
You can find this file in the / etc/hosts and / etc/sysconfig/networks folders.
Here are the contents of each file
/ etc/hosts
127.0.0.1 localhost.localdomain localhost dev-machine:: localhost 127.0.0.1/etc/sysconfig/network
How NETWORKING=yes NETWORKING_IPV6=no HOSTNAME=dev-machine displays the DNS domain name comes from the definition of hostname above, and hostname can also display the DNS name of your Linux. If your hostname command displays your hostname, then the dnsdomainname command will also display your domain name. Let's take a look at this simple example.
Dnsdomainname bris.co.id in this article, the result of the dnsdomainname command is bris.co.id.
If you see the result is (none), then your machine is not configured with FQDN (Fully Qualified Domain Name fully compliant domain name). The dnsdomainname command extracts the information from the / etc/hosts file. You should configure it to FQDN format. Here is a simple example:
/ etc/hosts
127.0.0.1 localhost.localdomain localhost dev-machine:: localhost 127.0.0.1 192.168.0.104 dev-machine.bris.co.id dev-machine to show more details, you can use the parameter-v
$dnsdomainname-v gethostname () = 'dev-machine.bris.co.id' Resolving' dev-machine.bris.co.id'... Result: how to display hostname more details the Hostname command can use multiple parameters and some aliases, such as the dnsdomainname command is an alias. These parameters are useful in daily operations. The results of the following commands are based on the above configuration of / etc/hosts.
Show IP address
$hostname-I 192.168.0.104 display domain name
$hostname-d bris.co.id displays the short hostname $hostname-s dev-machine
This command will produce the same result as entering hostname only
Show FQDN format
$hostname-f dev-machine.bris.co.id displays details
All parameters, including the above information, can be summarized by using the parameters-v and-d. Let's look at an example.
$hostname-v-d gethostname () = 'dev-machine.bris.co.id' Resolving' dev-machine.bris.co.id'... Result: do you feel familiar with the bris.co.id of 192.168.0.104 'bris.co.id? is it familiar to you? Result: hobnamebirds devasting machine.bris.co.id' bris.co.id: hobbies Yes, the running result is the same as the dnsdomainname-v command mentioned above.
What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.
This is how the Linux system displays and modifies all the contents of the host name. For more content related to how the Linux system displays and modifies the host name, you can search the previous articles or browse the following articles to learn! I believe the editor will add more knowledge to you. I hope you can support it!
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.