Ubuntu: Difference between revisions

From Han Wiki
Jump to navigation Jump to search
Tag: visualeditor
mNo edit summary
 
Line 4: Line 4:


# To '''permanently''' change the computer name<br>Edit <code>/etc/hostname</code> and <code>/etc/hosts</code>
# To '''permanently''' change the computer name<br>Edit <code>/etc/hostname</code> and <code>/etc/hosts</code>
# Restart hostname service <source lang="bash">
# Restart hostname service <syntaxhighlight lang="bash">
$ systemctl restart systemd-logind.service
$ systemctl restart systemd-logind.service
</source>
</syntaxhighlight>
# Use ''hostnamectl'' with ''set-hostname'' flag. <source lang="bash">
# Use ''hostnamectl'' with ''set-hostname'' flag. <syntaxhighlight lang="bash">
$ hostnamectl set-hostname NEW_NAME_HERE
$ hostnamectl set-hostname NEW_NAME_HERE
</source>
</syntaxhighlight>





Latest revision as of 08:54, 31 August 2023

Change hostname without a restart

  • Last tested on Ubuntu 16.04 (2018-04-23)
  1. To permanently change the computer name
    Edit /etc/hostname and /etc/hosts
  2. Restart hostname service
    $ systemctl restart systemd-logind.service
    
  3. Use hostnamectl with set-hostname flag.
    $ hostnamectl set-hostname NEW_NAME_HERE
    


Version specific