hostname & host
1.Hostname
/etc/hostname
-just contains just the name of the machine
sudo hostnamectl set-hostname new-name
service hostname restart
2.Host
/etc/hosts
-has entry for localhost
/etc/hostname
-just contains just the name of the machine
hostname --fqdn
sudo hostnamectl set-hostname new-name
$ hostnamectl --pretty set-hostname "$(perl -CO -le 'print "\x{1f389}"')"
$ hostnamectl --pretty status
service hostname restart
2.Host
/etc/hosts
-has entry for localhost
127.0.0.1 localhost.localdomain localhost 127.0.1.1 my-machine
3. Add your hostname to /etc/hosts like so:
echo $(hostname -I | cut -d\ -f1) $(hostname) | sudo tee -a /etc/hosts
Komentarze
Prześlij komentarz