2017-05-07 09:45:47 +01:00
|
|
|
# hostnamectl
|
|
|
|
|
|
|
|
> Get or set the hostname of the computer.
|
2021-09-02 19:33:49 +01:00
|
|
|
> More information: <https://manned.org/hostnamectl>.
|
2017-05-07 09:45:47 +01:00
|
|
|
|
|
|
|
- Get the hostname of the computer:
|
|
|
|
|
|
|
|
`hostnamectl`
|
|
|
|
|
|
|
|
- Set the hostname of the computer:
|
|
|
|
|
2021-01-30 21:00:35 +00:00
|
|
|
`sudo hostnamectl set-hostname "{{hostname}}"`
|
|
|
|
|
|
|
|
- Set a pretty hostname for the computer:
|
|
|
|
|
|
|
|
`sudo hostnamectl set-hostname --static "{{hostname.example.com}}" && sudo hostnamectl set-hostname --pretty "{{hostname}}"`
|
|
|
|
|
|
|
|
- Reset hostname to its default value:
|
|
|
|
|
|
|
|
`sudo hostnamectl set-hostname --pretty ""`
|