All checks were successful
code.softwareshinobi.com-learn/docker.softwareshinobi.com/pipeline/head This commit looks good
1.0 KiB
Executable File
1.0 KiB
Executable File
The hostnamectl command
The hostnamectl command provides a proper API used to control Linux system hostname and change its related settings. The command also helps to change the hostname without actually locating and editing the /etc/hostname file on a given system.
Syntax
$ hostnamectl [OPTIONS...] COMMAND ...
where COMMAND can be any of the following
status: Used to check the current hostname settings
set-hostname NAME: Used to set system hostname
set-icon-name NAME: Used to set icon name for host
Example
- Basic usage to view the current hostnames
$ hostnamectl
or
$ hostnamectl status
- To change the static host name to myhostname. It may or may not require root access
$ hostnamectl set-hostname myhostname --static
- To set or change a transient hostname
$ hostnamectl set-hostname myotherhostname --transient
- To set the pretty hostname. The name that is to be set needs to be in the double quote(” “).
$ hostname set-hostname "prettyname" --pretty