hostnamectl

NAME
hostnamectl – Control the system hostname

SYNOPSIS
hostnamectl [OPTIONS…] {COMMAND}

DESCRIPTION
hostnamectl may be used to query and change the system hostname and related settings.

CentOS 7

$ hostnamectl
   Static hostname: localhost.localdomain
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 4a4569389d534c75b42a67970a52946b
           Boot ID: 70e54525ec054d998fd7c76764860ae3
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1160.71.1.el7.x86_64
      Architecture: x86-64

Ubuntu 20.04

$ hostnamectl
   Static hostname: ubuntu
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 120a1da3bb7e48fa9a5c6cbf20d6dd1c
           Boot ID: 853400643e464d75a4122a22ca300450
    Virtualization: vmware
  Operating System: Ubuntu 20.04.4 LTS
            Kernel: Linux 5.13.0-52-generic
      Architecture: x86-64

WSL 2

$ hostnamectl
System has not been booted with systemd as init system (PID 1).
Can't operate.
Failed to create bus connection: Host is down