This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
internet:security:hosts_file [2012/04/17 14:55] gcooper |
internet:security:hosts_file [2019/04/23 10:14] (current) gcooper |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Hosts File ====== | ====== Hosts File ====== | ||
+ | |||
+ | See also a **better way**: **[[internet: | ||
The /etc/hosts file contains name resolution info that overrides DNS. You might add entries in the /etc/hosts file that is not in DNS. | The /etc/hosts file contains name resolution info that overrides DNS. You might add entries in the /etc/hosts file that is not in DNS. | ||
Line 17: | Line 19: | ||
</ | </ | ||
- | To use just this one list of adservers, remove | + | Remove |
==== yoyo.org ==== | ==== yoyo.org ==== | ||
- | Here we download another list and concatenate it with the previously downloaded list of adservers and your exxisting | + | Here we download another list and concatenate it with the previously downloaded list of adservers and your existing '' |
< | < | ||
wget -O hosts " | wget -O hosts " | ||
+ | sed -i ' | ||
+ | cat hosts >> hosts.txt | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | vim hosts.txt | ||
+ | |||
+ | # Set to unix file format | ||
+ | :set ff=unix | ||
+ | |||
+ | # Strip out DOS carriage returns - enter Ctrl-v Ctrl-m to input the '' | ||
+ | :%s/^M//g | ||
+ | |||
+ | # Strip all blank lines and comment lines | ||
+ | : | ||
+ | |||
+ | # Sort and remove duplicate lines | ||
+ | :sort u | ||
- | cat hosts >> /etc/hosts | ||
cat hosts.txt >> /etc/hosts | cat hosts.txt >> /etc/hosts | ||
</ | </ |