15

I want to redirect some sites to localhost. I can use hosts file which resides in directory C:\WINDOWS\system32\drivers\etc in windows.

Which is equivalent of this file in Ubuntu?

Rahul Virpara
  • 11,610
  • 11
  • 38
  • 50
  • 4
    Amusingly, the Windows hosts file is actually the equivalent of the Unix host file ; both files being kept in a folder called "etc" is a big clue. – Adrian Jul 22 '12 at 07:09

1 Answers1

17

In Ubuntu it is /etc/hosts. You can edit the file as same in other OSes.

Eliah Kagan
  • 116,445
  • 54
  • 318
  • 493
Web-E
  • 21,338
  • 12
  • 52
  • 93
  • What for then there is a `resolve.conf` in Ubuntu? – Green Jul 12 '16 at 14:48
  • @Green post new questions as questions, not as comments. Also, the grammar is not clear in that sentence. Should be "If there is an `/etc/hosts` file in Ubuntu, why does Ubuntu have a `resolve.conf` file too?" – Danny Varod Apr 11 '21 at 15:16