Hostnamectl-h
-H--help Display Help
--version Displays the version of the installation package
--transient Modifying the temporary host name
--static Modifying a static host name
--pretty Modifying a flexible host name
-P--privileged privileges obtained prior to execution
--no-ask-password Enter password without prompting
-H--host=[[email protected]]host Operation remote Host
Commands:
Status displays the current hostname settings
Set-hostname Name set the system host name
Set-icon-name Name set icon name for host
Set-chassis Name setting host platform type name
在CentOS7中有三种定义的主机名:
quiescent (static), transient (transient), and flexible (pretty).
The static hostname, also known as the kernel hostname, is the hostname that the system automatically initializes from within/etc/hostname at startup.
A transient hostname is a host name that is temporarily assigned when the system is running.
A flexible hostname allows the use of a host name with special characters.
For example:
View status: Hostnamectl or Hostnamectl status
Modify host Name: Hostnamectl set-name k8s-m2
Use of the Linux system command--hostnamectl