Este contenido no está disponible en el idioma seleccionado.
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 Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
To view all the current host names, enter the following command:
The
~]$ hostnamectl status
status option is implied by default if no option is given.
6.3.2. Set All the Host Names Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
To set all the host names on a system, enter the following command as
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 “
root:
~]# hostnamectl set-hostname name
-” and special characters will be removed.
6.3.3. Set a Particular Host Name Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
To set a particular host name, enter the following command as
Where option is one or more of:
root with the relevant option:
~]# hostnamectl set-hostname name [option...]
--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
6.3.4. Clear a Particular Host Name Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
To clear a particular host name and allow it to revert to the default, enter the following command as
Where "" is a quoted empty string and where option is one or more of:
root with the relevant option:
~]# hostnamectl set-hostname "" [option...]
--pretty, --static, and --transient.
6.3.5. Changing Host Names Remotely Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
To execute a
Where hostname is the remote host you want to configure. The username is optional. The hostnamectl tool will use
hostnamectl command on a remote system, use the -H, --host option as follows:
~]# hostnamectl set-hostname -H [username]@hostname
SSH to connect to the remote system.