/etc/hosts has tons of duplicate entries
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
4 Replies
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)
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:
mv hosts.temp /etc/hosts
Delete the hosts file with thousands of bogus lines.
Create a new hosts file with the 3-4 lines that you require.