Back to the command reference

hostnamectl

SystemFundamentalsReference only

Show or set the host name and system info

Name: hostnamectl = hostname control

This command is outside what the site lets you practise (mostly distribution-specific or rarely used tools). This page describes how to use it; try it on your own Linux system.

Description

hostnamectl, part of systemd, shows and permanently sets the host name, and also reports the OS, kernel, architecture and virtualisation type.

Syntax

hostnamectl [COMMAND]

Common options

statusShow the host name, system and kernel (as with no arguments)
set-hostnameChange the host name permanently

Examples

  • $ hostnamectl

    Host name, OS, kernel and architecture

    Explain
  • $ sudo hostnamectl set-hostname web01

    Rename the machine

    Explain

Related