Use of Hostnamectl in CentOS 7

Source: Internet
Author: User

Hostnamectl is a newly added command in Centos7, it is used to modify the host name, CENTOS7 modifying the host name will be much easier than ever.

usage
# hostnamectl-h  -H--help              Display Help     --version           Displays the version of the installation package     --transient Modify the         temporary hostname     --static            Modify the transient hostname     --pretty            Modify the flexible hostname  -P--privileged the        privileges obtained before execution     --no-ask-password Enter the   password without prompting -  H--host=[[email protected]]host  operation remote host commands:  status                 Display current hostname settings  set-hostname name Set      the system hostname  set-icon-name Name set     the host       platform type name for the host setting icon name Set-chassis name

There are three definitions of host names in CentOS7: 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.

Common Commands 1. View status
# Hostnamectl or # Hostnamectl status   (shows the same results)   Static hostname:localhost.localdomain         Icon Name: COMPUTER-VM           CHASSIS:VM Machine        id:049717292ec9452890e50401d432e43c           Boot ID: 2e69a66a7c724db6a44a8536f1670f7f    VIRTUALIZATION:KVM  Operating system:centos Linux 7 (Core)       CPE OS Name: Cpe:/o:centos:centos:7            kernel:linux 3.10.0-229.el7.x86_64      architecture:x86_64
2. Modify the host name
# hostnamectl set-hostname linuxprobe# hostnamectl status   Static hostname:linuxprobe pretty   hostname: Linuxprobe         Icon name:computer-vm           chassis:vm machine        id:dc99c115d7414d159fa4c5c0c0541c55           Boot ID: 6236b67c13af4d98b5fa3780e66dfdeb    VIRTUALIZATION:KVM  Operating system:centos Linux 7 (Core)       CPE OS Name: Cpe:/o:centos:centos:7            kernel:linux 3.10.0-229.el7.x86_64      architecture:x86_64

Free to provide the latest Linux technology tutorials Books, for open-source technology enthusiasts to do more and better: http://www.linuxprobe.com/

Use of Hostnamectl in CentOS 7

Related Article

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.