just saw sparkmoods answer to this question: How to block any site? but he didn't provide enough information for me to act on his answer. I'm not sure where /etc/hosts is.
Asked
Active
Viewed 62 times
-2
-
"I'm not sure where /etc/hosts is." What's the problem? That is the correct location. – DK Bose Mar 18 '16 at 17:24
-
`/etc/hosts` is a file under the directory named `etc`, under `/` (the root of your filesystem). There is plenty of information. If you don't really understand UNIX paths, you may want to do some research on the filesystem. – TheWanderer Mar 18 '16 at 17:31
-
thank's Zacharee, my appologies for not trying harder. I couldn't find it because I didn't realize the terminal didn't open already at the root. now I just need to change the permissions. I've tried sudo gedit /etc/hosts in the terminal, as suggested by Gabriel, and it didn't like it: – juggler Mar 18 '16 at 18:27
-
mikethe1wheelnut@mikethe1wheelnut-OptiPlex-9010:~$ sudo gedit /etc/hosts [sudo] password for mikethe1wheelnut: (gedit:5719): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files (gedit:5719): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files mikethe1wheelnut@mikethe1wheelnut-OptiPlex-9010:~$ – juggler Mar 18 '16 at 18:27
2 Answers
1
You can easily edit /etc/hosts by typing sudo gedit /etc/hosts in the terminal.
What you are doing here is exactly what people commented on your question: there is a etc folder at the root of your filesystem and there is a hosts files inside the etc folder. There is no extension to this file, it is a plain text file called hosts.
You edit it and the system knows where to go when looking for a given nameserver. So if you wanna block google you add
127.0.0.1 google.com
On your hosts file.
On a sidenote, 127.0.0.1 is an special address every IPv4 computer uses to refer to itself, which explains "localhost". Anything you point to it points to itself, therefore blocking the content.
EDIT: I'll post that to your original question.