8

I installed Ubuntu, went straight to the Terminal and noticed there is some odd characters in my name. Here's what it is:

imageek@imageek-DP700A3D-DM700A3D-DB701A3D-DP700A7D:

How do I change this?

Braiam
  • 67,791
  • 32
  • 179
  • 269
Im A Geek
  • 183
  • 4
  • 2
    To answer the Why? part: Those are not odd characters, that is the Product name of your computer. If you choose the default values at installation your hostname will be set to username-productname. Your BIOS identifies your machine as DP700A3D-DM700A3D-DB701A3D-DP700A7D (or "DP700A3D DM700A3D DB701A3D DP700A7D"). So we now know that you have a Samsung All-in-one PC. – falconer Jan 31 '14 at 22:14

1 Answers1

9

You can "test" a new hostname with the command :

sudo hostname new_hostname

(this will not last after reboot)


SOLUTION 1 : Edit /etc/hostname, and replace the current name imageek-DP700A3D-DM700A3D-DB701A3D-DP700A7D with the new one.

gksu gedit /etc/hostname 

SOLUTION 2 : You can also use :

sysctl kernel.hostname

to read the current hostname, and

sudo sysctl kernel.hostname=NEW_HOSTNAME

to change it.

/!\ ATTENTION : When using any of those methods, you will also want to change your hostname in /etc/hosts to avoid the error message when using sudo : "sudo : unable to resolve hostname new_hostname" :

gksu gedit /etc/hosts

SOLUTION 3 : You can also do this with a graphical interface. You have to install gnome-network-admin :

sudo apt-get install gnome-network-admin
MrVaykadji
  • 5,875
  • 2
  • 32
  • 55
  • There is no need to edit /etc/hosts , its for ip mapping – nux Jan 31 '14 at 19:42
  • Well, in /etc/hosts, you have a line 127.0.1.1 hostname. And on the french Ubuntu-fr.org, I can see they recommend to edit both files. – MrVaykadji Jan 31 '14 at 19:45
  • no its not necessary for his case , the name is the host-name for his machine , try just to edit the host-name and it will change , – nux Jan 31 '14 at 19:48
  • /etc/hosts act like dns you can map a name to an ip so if you type localhost the computer know that its ip is 127.0.0.1 – nux Jan 31 '14 at 19:49
  • I just changed /etc/hostname and rebooted, without changing the /etc/hosts file, you have an error : sudo : unable to resolve host new_hostname. I'm guessing you're wrong here. – MrVaykadji Jan 31 '14 at 19:52
  • you should mention the use of /etc/hosts for this purpose not for changing the name in terminal . – nux Jan 31 '14 at 19:55
  • 1
    that a good answer my friend , i hope we just learn from conversation don't take it as personal view – nux Jan 31 '14 at 20:01
  • I just edited with your recommendation. I think it's more readable now. I've added the /etc/hosts thing in a note. – MrVaykadji Jan 31 '14 at 20:04