hostnamectl Command Examples

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

hostnamectl

sudo hostnamectl set-hostname "{{hostname}}"

sudo hostnamectl set-hostname --static "{{hostname.example.com}}" && sudo hostnamectl set-hostname --pretty "{{hostname}}"

sudo hostnamectl set-hostname --pretty ""