1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 14:42:07 +02:00
tldr/pages/linux/hostnamectl.md
2021-09-02 20:33:49 +02:00

503 B

hostnamectl

Get or set the hostname of the computer. More information: https://manned.org/hostnamectl.

  • Get the hostname of the computer:

hostnamectl

  • Set the hostname of the computer:

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 ""