How to update the /etc/hosts file? Pluma and VI not working

Good evening,

I’m hoping someone can help me with what appears to be a very simple but maddening issue. I am attempting to change my hostname. I have done so and now am attempting to update the /etc/hosts file to match but none of the command line utilities I am accustomed to use for such a task such as VI are working correctly and Pluma will not start in ADMIN mode.

in VI keys just randomly stop responding or produce nonsensical output, (only in the VI program, works fine in other programs, so I don’t think it’s a keyboard issue.)

Puma displays a GTK error when starting under SUDO but NOT when starting in usermode.

I’m very confused at this behavior by what are very simple utilities… :frowning:

Running Ubuntu-Mate 16.04 on VirtualBox

I just was able to solve my own issue. Using gksudo instead of sudo allows me to launch Pluma, though this still does not explain why vi doesn’t work correctly nor why right clicking the file in Caja and selecting “open as administrator” does not work. Any thoughts on that still welcome. :slight_smile:

or you could change with nano using sudo nano /etc/hosts

1 Like

First, always use gksudo when opening GUI applications as root.
Then, I cannot speak for vi, I am a vim user but it is almost identical.

If you want to edit a file:

sudo vi or vim _your.file_

Now my question. What exactly do you want to change? Because if it is the hostname, the file would be in /etc/hostname. I can also open it as administrator on my machine without problems from Caja.

@David_Dusanic

I edited the hostname with another utility, but you have to change the hostname entry for the loopback IP for some utilities to work correctly. SUDO for some reason complains (but works) if this is not done.

@Cipri_Sabo I’ve never really gotten used to using NANO.