Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the hostnamectl command in centos7.3?

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

What is the hostnamectl command in centos7.3? for this question, this article introduces the corresponding analysis and answer in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

Hostnamectl is a new command added in centos7 and above, and it is used to modify the host name, and it will be much easier for centos7 to change the host name.

First of all, understand this command.

# hostnamectl-h

-h-- help display help

-- version displays the version of the installation package

-- transient modifies temporary hostname

-- static modifies transient hostname

-- pretty modifies flexible hostname

-P-privileges obtained by privileged prior to execution

-- no-ask-password does not prompt for a password

-H-- host= [user @] HOST operates the remote host

Commands: status

Show current hostname settings set-hostname NAME

Set the system hostname set-icon-name NAME

Set the icon name set-chassis NAME for the host

Set the host platform type name

There are three defined hostnames in CentOS7: static, transient, and pretty. The static hostname, also known as the kernel hostname, is the hostname that the system initializes automatically from within / etc/hostname at startup. The transient hostname is the hostname temporarily assigned while the system is running. Flexible hostnames allow hostnames with special characters.

Question one, how did the uppercase hostname I typed become lowercase?

This is because when you modify a static / transient hostname, any special or white space characters are removed, and any uppercase letters in the supplied parameters are automatically converted to lowercase. Once the static hostname is modified, / etc/hostname will be updated automatically. However, / etc/hosts will not be updated to save your changes, so you need to update / etc/hosts manually. If you only want to change a specific hostname (static, transient, or flexible), you can use the "--static", "--transient" or "--pretty" options. Question 2, how to modify the hostname is permanent? To permanently modify the hostname, modify the static hostname: $sudo hostnamectl-- static set-hostname note that you do not have to restart the machine to activate the permanent hostname modification. The above command immediately modifies the kernel hostname. Log out and log back in to observe the new static hostname at the command line prompt. Question 3. How to find the uppercase host name $sudo hostnamectl status-pretty entered by yourself

This is the answer to the question about how and what the hostnamectl command in centos7.3 is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report