Where is hosts file in Linux

When one starts new in Linux, there are a lot of questions one have in mind. A lot of time when you are debugging a web application that requires the URL must be a valid domain Url and not localhost, then you have to use hosts file to add entry for that URL pointing to loopback address.

So question that will come to your mind is Where is hosts file in Linux?. In case of Windows operating system, you will find the file in {system drive}\Windows\System32\drivers\etc. In Linux location of hosts file is somewhat in same location. It is present in /etc folder. Just execute cat /etc/hosts command you will see content of this file.

naveen@BlockChain-1:$ cat /etc/hosts localhost BlockChain-1

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters




8.9 °C / 48.1 °F

weather conditions Clouds

Monthly Posts

Blog Tags