Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sun Jul 18, 2010 2:33 am 
Offline
Senior Newbie

Joined: Sat Jul 17, 2010 12:36 am
Posts: 6
I added a line to the /etc/hosts file per http://library.linode.com/getting-started/.

Later I checked back and there are hundreds if not thousands of duplicates of that line I added. Is this a problem? Have I done something wrong?

Note: I am newwb with a double double u, and I do fully understand what /etc/hosts does


Top
   
 Post subject:
PostPosted: Sun Jul 18, 2010 3:01 am 
Offline
Senior Member

Joined: Tue Feb 19, 2008 10:55 am
Posts: 164
did you use vim to edit the file?

my guess is you fat fingered by pressing numbers within command mode and accidentally duplicated a line while saving and exiting.

just delete them (in vim, dd deletes a line, 10dd deletes 10 lines) it won't happen again (unless you press numbers while in command mode again)


Top
   
 Post subject:
PostPosted: Sun Jul 18, 2010 5:36 pm 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
One way to remove duplicate lines:
Code:
uniq /etc/hosts > hosts.temp

Look at the hosts.temp file to make sure it's what you want. Edit if necessary (nano is a bit more user-friendly than vi). Then replace the hosts file with:
Code:
mv hosts.temp /etc/hosts


Top
   
 Post subject:
PostPosted: Sun Jul 18, 2010 10:30 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
Another way to remove surplus lines.

Delete the hosts file with thousands of bogus lines.

Create a new hosts file with the 3-4 lines that you require.


Top
   
 Post subject:
PostPosted: Sun Jul 18, 2010 10:50 pm 
Offline
Senior Newbie

Joined: Sat Jul 17, 2010 12:36 am
Posts: 6
thanks for the comprehensive reply. all it happy again


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group