Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

6.3. Configuring Host Names Using hostnamectl


The hostnamectl tool is provided for administering the three separate classes of host names in use on a given system.

6.3.1. View All the Host Names

To view all the current host names, enter the following command:
~]$ hostnamectl status
Copy to Clipboard Toggle word wrap
The status option is implied by default if no option is given.

6.3.2. Set All the Host Names

To set all the host names on a system, enter the following command as root:
~]# hostnamectl set-hostname namehostnamectl set-hostname name
Copy to Clipboard Toggle word wrap
This will alter the pretty, static, and transient host names alike. The static and transient host names will be simplified forms of the pretty host name. Spaces will be replaced with - and special characters will be removed.

6.3.3. Set a Particular Host Name

To set a particular host name, enter the following command as root with the relevant option:
~]# hostnamectl set-hostname name [option...]hostnamectl set-hostname name [option...]hostnamectl set-hostname name [option...]hostnamectl set-hostname name [option...]hostnamectl set-hostname name [option...]
Copy to Clipboard Toggle word wrap
Where option is one or more of: --pretty, --static, and --transient.
If the --static or --transient options are used together with the --pretty option, the static and transient host names will be simplified forms of the pretty host name. Spaces will be replaced with - and special characters will be removed. If the --pretty option is not given, no simplification takes place.
When setting a pretty host name, remember to use the appropriate quotation marks if the host name contains spaces or a single quotation mark. For example:
~]# hostnamectl set-hostname "Stephen's notebook" --pretty
Copy to Clipboard Toggle word wrap

6.3.4. Clear a Particular Host Name

To clear a particular host name and allow it to revert to the default, enter the following command as root with the relevant option:
~]# hostnamectl set-hostname "" [option...]hostnamectl set-hostname "" [option...]hostnamectl set-hostname "" [option...]hostnamectl set-hostname "" [option...]hostnamectl set-hostname "" [option...]
Copy to Clipboard Toggle word wrap
Where "" is a quoted empty string and where option is one or more of: --pretty, --static, and --transient.

6.3.5. Changing Host Names Remotely

To execute a hostnamectl command on a remote system, use the -H, --host option as follows:
~]# hostnamectl set-hostname -H [username]@hostnamehostnamectl set-hostname -H [username]@hostnamehostnamectl set-hostname -H [username]@hostnamehostnamectl set-hostname -H [username]@hostnamehostnamectl set-hostname -H [username]@hostnamehostnamectl set-hostname -H [username]@hostname
Copy to Clipboard Toggle word wrap
Where hostname is the remote host you want to configure. The username is optional. The hostnamectl tool will use SSH to connect to the remote system.
Nach oben
Red Hat logoGithubredditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können. Entdecken Sie unsere neuesten Updates.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

Theme

© 2025 Red Hat