Use command to clear specific hostname in CentOS7

Copyright statement: This article is an original article of hard work, and all major self-media platforms are updated simultaneously. Welcome to reprint, please indicate the source, thank you

The name of my previous blog was Dianchi Guhong, which was later changed to the current name. The host name of the machine I use for experimentation will also be changed. The host name was DCGH before, but now the host name is ChatDevOps. Changed this morning After finishing the hostname, I found that the pretty hostname always exists, even after logging out or restarting.

[ root@ChatDevOps ~]# hostnamectl 
 Static hostname: ChatDevOps
 Pretty hostname: DCGH
   Icon name: computer-vm
   Chassis: vm
  Machine ID: 266d7690f650a21312d325235ad7f7a7
   Boot ID: 97b7b37fa5ea4b2582006e8ca15d2242
 Virtualization: kvm
 Operating System: CentOS Linux 7(Core)
  CPE OS Name: cpe:/o:centos:centos:7
   Kernel: Linux 3.10.0-693.17.1.el7.x86_64
  Architecture: x86-64

Later, I looked at the official documents of Redhat. The specific hostname in CentOS7 can be cleared. The specific commands are as follows:

[ root@ChatDevOps ~]# hostnamectl set-hostname ""--pretty

Look again to see if the removal is successful:

[ root@ChatDevOps ~]# hostnamectl 
 Static hostname: ChatDevOps
   Icon name: computer-vm
   Chassis: vm
  Machine ID: 266d7690f650a21312d325235ad7f7a7
   Boot ID: 97b7b37fa5ea4b2582006e8ca15d2242
 Virtualization: kvm
 Operating System: CentOS Linux 7(Core)
  CPE OS Name: cpe:/o:centos:centos:7
   Kernel: Linux 3.10.0-693.17.1.el7.x86_64
  Architecture: x86-64

The complete command format is like this:

# hostnamectl set-hostname ""[option...]

Where "" is a bracketed blank string, option is one or more of pretty, static and transient.

Recommended Posts

Use command to clear specific hostname in CentOS7
How to use dpkg command in Ubuntu system
Update gcc to 6.4.0 in centos
How to use hanlp in ubuntu
Use nohup command instructions in python
Detailed use of nmcli in CentOS8
How to install HDP2.6 in Centos7.2
How to clear variables in python
Use VMware15 to install Linux (CentOS6.5)
How to use SQLite in Python
How to install Android SDK in centos7
Use NTP for time synchronization in CentOS 7
Use supermin to make CentOS Docker image
How to modify the hostname on CentOS 8
Centos8 use yum to install rabbitmq tutorial
How to use the round function in python
CentOS Discovery Road 2---Use rpm to install JDK
Ways to clear disk space on CentOS 6 or CentOS 7
How to configure TensorFlow use environment in Ubuntu
How to install and use Docker on CentOS 7
How to use the zip function in Python
Configure centos container to support ssh in Docker
Use the command to solve the Ubuntu projector problem:
How to use the format function in python
How to install and use Composer on CentOS 8
How to use code running assistant in python
How to install php7.3 in centos8 custom directory
How to install and use Curl on CentOS 8
Modify CentOS hostname
Centos7 uses Ansible to install Chinese fonts in batches
Use Rancher to build a K8s cluster under CentOS7
Use the command line to detect the Ubuntu version method
How to create a CentOS virtual machine in VMware
Use Cobbler to automate batch deployment of CentOS / Ubuntu
How to use Putty to log in to ubuntu installed in VirtualBox
How to create a CentOS virtual machine in VMware
How to install and use Cockpit on CentOS 8/RHEL 8
How to use Let's Encrypt to protect Nginx on CentOS 8