คำสั่ง hostname

hostname : this command can get or set the host name or the NIS domain name. You can
also get the DNS domain or the FQDN (fully qualified domain name).

Show hostname

Show FQDN

Show domain name

Temporary change the host name.

This is only effective till a reboot.

-i คืนค่า ip จริงของโดเมนนั้น ๆ ไม่ได้คืนค่า ip ของ host เรา

Set the fully qualified domain name (FQDN)

ไฟล์ /etc/hosts เปลี่ยนบรรทัด 127.0.1.1 ให้เป็นชื่อ FQDN ทีต้องการ (hostname.domainname)

ไฟล์ /etc/hostname เปลี่ยนให้เป็นชื่อ hostname ที่ต้องการ

Show hostname

Show FQDN

Show domain name

Link