When I connect to my server (ubuntu server 10.10), I get this:
Apr 19, 2018 Ubuntu Change Hostname or Computer name. As we all know that Ubuntu is a free and secure OS to use but, we can see many people complain about its user-friendliness because most of the settings related to Ubuntu should be done only by the terminal which contains many commands to remember, The main problem among all those problems is How to Change Hostname or in other. How to change hostname on CentOS and Ubuntu Hostname is a label used to identify the machine. Check the current hostname on CentOS or Ubuntu. Change the current hostname on CentOS or Ubuntu. More command options. For more command options you can add the -help flag at the end.
How can I remove '.belkin'?
Jorge Castro37.6k108108 gold badges426426 silver badges621621 bronze badges
WolfyWolfy3,4621212 gold badges2828 silver badges3939 bronze badges
13 Answers
You need to edit the computer name in two files:
and
These will both need administrative access, so run
Replace any instances of the existing computer name with your new one. When complete run
The name will also be changed if you restart your computer.
See also:
richzillarichzilla8,0891717 gold badges4444 silver badges6161 bronze badges
hostnamectl set-hostname
on 13.10+ desktopThis is the best way if you have systemd (13.10 onwards) and if cloud-init is not active (see below):
It:
- does not require rebooting
- persists after reboots
More info at: https://askubuntu.com/a/516898/52975
18.04 onwards: cloud-init
18.04 Introduced cloud-init which can control setting of the hostname so
hostnamectl
changes it won't stick after a reboot if cloud-init is installed. TODO: how to check if it is installed, is it installed by default on the desktop image or just server?If you want
hostnamectl
changes to stay after a reboot, then you'll need to edit the cloud-init config files, disable cloud-init's hostname set/update module:or disable cloud-init entirely:
See also: How do I change the hostname without a restart?
![Change Change](http://ubuntuhandbook.org/wp-content/uploads/2013/10/Computer-Name-Ubuntu1310.jpg)
11.1k55 gold badges5252 silver badges5454 bronze badges
It's quite easy:
- Edit
/etc/hostname
, make the name change, save the file. - You should also make the same changes in
/etc/hosts
file - Run
sudo service hostname start
As long as you have no application settings depending on the 'old' hostname, you should be ok ;-)
Pavlos G.Pavlos G.7,50611 gold badge2828 silver badges3333 bronze badges
It is safe to do, you just need to be sure you edit both the system hostname configuration file (/etc/hostname) and the hostname name resolution file (/etc/hosts).From a terminal execute the following:
João PintoJoão Pinto15.1k33 gold badges4646 silver badges6161 bronze badges
In addition to editing /etc/hosts and /etc/hostname, various services might have issues with the change as well. Mysql and postfix are installed by default in ubuntu. A broken postfix won't affect most ubuntu users, since it's a background email server that isn't used by much.
Postfix:
The default config for mysql doesn't use hostname, so it will work fine as-is. If you have customized it, edit the files in /etc/mysql/ and restart the service.
You may also want to edit /etc/motd (message of the day), which is shown on virtual terminals and remote logins. That one won't harm anything though.
Other services that you may have installed that would need fixing are apache, bind9, etc. In each case, find and edit the hostname in their config and restart the service.
ImaginaryRobots![Ubuntu change hostname 18.10 Ubuntu change hostname 18.10](/uploads/1/2/5/8/125803020/974150121.jpg)
7,31144 gold badges2626 silver badges3636 bronze badges
The host name uniquely identifies your computer on the local network (and possibly on the Internet as well) so it's not a good idea to change it unless you know what you are doing.
But you can change the shell prompt not to display the
.belkin
(domain name part):See the bash man page and specifically the section on prompting for more information.
Riccardo MurriRiccardo Murri13.9k55 gold badges4444 silver badges4949 bronze badges
Another better and safe way to rename hostname
Install ailurus
- Add the PPA and update your repository
sudo add-apt-repository ppa:ailurus && sudo apt-get update
- Install ailurus
sudo apt-get install ailurus
- After installation it will be found under Applications>>System Tools>>Ailurus
51.5k5555 gold badges171171 silver badges221221 bronze badges
If you don't want to play with a text editor, Ubuntu Tweak (grab the deb from their website) has that as one of the little things you can play with (along with lots of other little tweaks that you might want to make but don't really want to play around with the terminal and the files themselves).
dkuntz2dkuntz2
Use the
hostname
command to change your hostnameHowever, this does not edit your hosts file, which you must do so as to make sure that your computer recognizes itself
And add a new entry for your hostname pointing to 127.0.0.1
You could remove the old entry as well, but I prefer to keep it there.
NemoNemo6,74155 gold badges4141 silver badges6363 bronze badges
The following command change the hostname on the fly but to make it permanent, you have to edit
/etc/hostname
:Open a new terminal session and you'll see it right away.
With
wjandreasystemd
in place, the proper way to do it is9,83944 gold badges2828 silver badges6767 bronze badges
Terry WangTerry Wang6,77733 gold badges2525 silver badges2525 bronze badges
If you want a GUI assisted process install Ubuntu-Tweak. Among other uses of this app is the ability to change computer name through tab 'Computer-Details' -> 'Hostname'
13east13east1,65722 gold badges1717 silver badges2323 bronze badges
SystemSettings -> Details -> Overwiev (default opened in U16.04) - Device Name.
but additionally you must change name in /etc/hosts. Ubuntu BUG()?
udroidmanudroidman
SergioAraujoSergioAraujo
protected by Community♦Jan 17 '17 at 22:56
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Would you like to answer one of these unanswered questions instead?