How to set hostname from terminal Set the system hostname on Linux using hostnamectl. hostnamectl set-hostname example.com