search
HomeOperation and MaintenanceCentOSHow to check centos host name

In centos, you can use the hostnamectl command to query the host name. The function of this command is to manage the host name. When this command does not take parameters, you can view the host name information. The syntax is "hostnamectl".

How to check centos host name

The operating environment of this article: centos 6.4 system, Dell G3 computer.

How to check the centos host name

1. Check the host name

CentOS7 uses the hostnamectl command to manage the host name. This command can be used without parameters. Check the host name information

[root@CentOS7-1 ~]# hostnamectl
   Static hostname: CentOS7-1
         Icon name: CentOS7-1
           Chassis: vm
        Machine ID: 0b269f4da7e94412992cbfa2562855be
           Boot ID: 24c06429f69048639a7e155f7d14ef87
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-862.el7.x86_64

2. Check the virtualization

In fact, this command is very powerful and you can also see the type of virtualization. For example, I am using vmware now. . Therefore, we can know through this command that

AWS uses xen

Alibaba Cloud uses kvm

JD Cloud also uses kvm

No Tencent Cloud’s host, I don’t know what it is

3. Types of host names

In CentOS7, there are three types of host names (said in the man manual, in fact There are 4 in total including icon name), namely pretty, static and transient.

pretty: can contain various special characters

static: used to initialize the kernel host name at startup. Only characters that can be used as domain names are used. This name is what we see in the terminal. Name

transient: The default temporary hostname received from the network configuration, which can only use characters that can be used as domain names

static hostname is saved in /etc/hostname, and pretty hostname and icon name is saved in /etc/machine-info

If a static hostname is set and the hostname is valid (not localhost), the temporary hostname is not used.

4. Set the host name

In addition, if you use hostnamctl set-hostname NAME, pretty will accept uppercase letters, and static will convert uppercase letters to lowercase letters. .

But what if we really want the static hostname to be capitalized? Then we can bring parameters and set

hostnamectl --pretty set-hostname TEST-name    # 设置pretty hostname
hostnamectl --static set-hostname TEST-name    # 设置static hostname
hostnamectl --transient set-hostname TEST-name    # 设置transient hostname

5 and icon name

respectively. Let's talk about the icon name. This name is mainly used in some graphical interfaces. Some desktops will read this parameter as the host name, similar to "this computer" on Windows. You can use the following command to set it

hostnamectl set-icon-name MY-comp

Recommended tutorial: "centos tutorial"

The above is the detailed content of How to check centos host name. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
CentOS's Replacement: Exploring the New OptionsCentOS's Replacement: Exploring the New OptionsApr 28, 2025 am 12:17 AM

CentOS alternatives include RockyLinux, AlmaLinux, and OracleLinux. 1. RockyLinux and AlmaLinux provide stable distributions compatible with RHEL, suitable for users who need long-term support. 2. CentOSStream is suitable for users who focus on new features and development cycles. 3. OracleLinux is suitable for users who need enterprise-level support.

Replacing CentOS: Identifying Suitable ReplacementsReplacing CentOS: Identifying Suitable ReplacementsApr 27, 2025 am 12:04 AM

CentOS needs alternatives because CentOSStream no longer provides long-term support. Alternative options include: 1. RockyLinux, which provides 10 years of life cycle support, suitable for users who need stability. 2.AlmaLinux also provides 10 years of support and has strong community support. 3. OracleLinux, provides RHEL-compatible version, and flexible life cycle management.

The End of CentOS: Evaluating the ImpactThe End of CentOS: Evaluating the ImpactApr 26, 2025 am 12:03 AM

The end of CentOS has had a significant impact on users, with users having the option of RHEL, AlmaLinux, Debian or Ubuntu as alternatives. 1. The migration cost is high, requiring time and money. 2. Community division affects open source projects. 3.RHEL provides commercial support, but it is costly. 4.AlmaLinux is similar to CentOS and has low migration costs. 5. Debian and Ubuntu need more time to adapt.

CentOS: An Explanation of the Decision-Making ProcessCentOS: An Explanation of the Decision-Making ProcessApr 25, 2025 am 12:03 AM

CentOS is suitable as an enterprise-class server operating system because it is stable, secure and free. 1) It is based on RHEL and provides high compatibility with RHEL. 2) Use yum for package management to ensure that the software is easy to install and update. 3) The community regularly releases security patches, with a support cycle of up to 10 years.

The Discontinuation of CentOS: Understanding the FactorsThe Discontinuation of CentOS: Understanding the FactorsApr 24, 2025 am 12:01 AM

The reason why CentOS stopped maintaining is RedHat's strategic change. User response strategies include: 1. Migrating to other distributions, such as UbuntuServer, Debian or RockyLinux; 2. Continue to use CentOS7 until June 2024; 3. Turning to CentOSStream; 4. Build solutions, such as custom distributions based on RHEL or using container technology.

CentOS: What Led to the Decision to End SupportCentOS: What Led to the Decision to End SupportApr 23, 2025 am 12:10 AM

RedHatendedsupportforCentOStoshifttowardsacommerciallyfocusedmodelwithCentOSStream.1)CentOStransitionedtoCentOSStreamforRHELdevelopment.2)ThisencourageduserstomovetoRHEL.3)AlternativeslikeAlmaLinux,RockyLinux,andOracleLinuxemergedasreplacements.

Using CentOS: A Guide for System AdministratorsUsing CentOS: A Guide for System AdministratorsApr 22, 2025 am 12:04 AM

CentOS is an open source operating system based on RedHatEnterpriseLinux, suitable for server environments. 1. Select the appropriate media and options during installation and configure network, firewall and user permissions. 2. Use useradd, usermod and systemctl commands to manage users and services, and update software packages regularly. 3. Basic operations include using yum installation software and systemctl management services, and advanced features such as SELinux to enhance security. 4. Check the system log to solve common errors. Optimizing performance requires monitoring resources and cleaning of unnecessary files.

CentOS: Security, Stability, and PerformanceCentOS: Security, Stability, and PerformanceApr 21, 2025 am 12:11 AM

CentOS is the first choice for server and enterprise environments for its superior security, stability and performance. 1) Security provides forced access control through SELinux to improve system security. 2) Stability is supported by the LTS version for up to 10 years to ensure the stability of the system. 3) Performance significantly improves system response speed and resource utilization by optimizing kernel and system configuration.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function