Adding or editing an entry in /etc/hosts

William Stephens wstephens10 at cox.net
Sat Jan 6 17:38:42 UTC 2007


On Sat, 2007-01-06 at 07:54 -0800, Danny Colligan wrote:
>         On Sat, 2007-01-06 at 09:37 -0500, Brian Lunergan wrote:
>         > Rebel Lion wrote:
>         > >  See what ifconfig tells you, you shouldn't need sudo for
>         that, you are going 
>         > > to have hassles trying to edit the hosts file though
>         because you need to be 
>         > > sudo to do it. You are probably going to have to login in
>         recovery mode to
>         > > fix it.
>         > >
>         >
>         > That's the direction I went. Started up in recovery mode
>         through grub, logged in 
>         > as root, and cd /etc to drop into the directory. That's
>         where I'm stuck for the
>         > moment. Using gedit in the gnome desktop is easy enough (if
>         I weren't locked out
>         > in read only for not being the owner in that environment)
>         but I'm still too much 
>         > of a neophyte to know what command I use to open and edit
>         the hosts file from
>         > the command line as root.
>         >
>         > Thoughts??
>         >
>         
>         Hi,
>         
>         sudo vim hosts
>         
>         vim is my preferred text editor, if your not familiar with vim
>         type 
>         vimtutor at command line.
>         
>         William S.
> 
> Telling someone unfamiliar with terminal based-editors to use vim is
> almost certainly a Bad Idea (tm).  Not to say that Vim isn't a great
> editor (my favorite, as well) but he'll probably end up butchering his
> file in the process.  ("Hey, it's not typing anything when I push
> letters!  And now it's beeping at me!  Aha, here is something... wait,
> how come those letters were just erased?")  Better to use something
> that isn't modal and doesn't have such a steep learning curve to be
> minimally functional such as emacs or nano to avoid creating another
> problem in addition to his current one. 
> 
> If you are learning a terminal-based text editor and are in it for the
> long haul, however, vim is an excellent option to consider.

I guess i could have said alt+F2>gksu gedit for gui solution





More information about the ubuntu-users mailing list