{"id":4267,"date":"2026-11-05T14:33:00","date_gmt":"2026-11-05T14:33:00","guid":{"rendered":"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/"},"modified":"2026-11-09T22:05:08","modified_gmt":"2026-11-09T22:05:08","slug":"hosts-file-location","status":"publish","type":"post","link":"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/","title":{"rendered":"Where Is the Hosts File? Windows, Mac and Linux Locations"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">On Windows the hosts file is <code>C:\\Windows\\System32\\drivers\\etc\\hosts<\/code> (a file called <code>hosts<\/code> with no extension). On macOS and Linux it is <code>\/etc\/hosts<\/code>; on a Mac, <code>\/etc<\/code> is a symbolic link to <code>\/private\/etc<\/code>, so the real file is <code>\/private\/etc\/hosts<\/code>. In all three you need administrator or root rights to change it, and the file is checked before DNS, so a line in it overrides what the rest of the internet sees for that name, on your computer only.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"212\" src=\"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/11\/hosts-file-location-screenshot-1024x212.png\" alt=\"Terminal showing ls -l \/etc\/hosts and getent resolving a test name from the hosts file\" class=\"wp-image-4269\" srcset=\"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/11\/hosts-file-location-screenshot-1024x212.png 1024w, https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/11\/hosts-file-location-screenshot-300x62.png 300w, https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/11\/hosts-file-location-screenshot-768x159.png 768w, https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/11\/hosts-file-location-screenshot.png 1100w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">On Linux the hosts file is \/etc\/hosts; a line added there is used at once, as getent shows<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>System<\/th><th>Hosts file location<\/th><th>Edit with<\/th><\/tr><\/thead><tbody><tr><td>Windows (desktop and Server)<\/td><td><code>C:\\Windows\\System32\\drivers\\etc\\hosts<\/code> (<code>%WinDir%\\System32\\Drivers\\Etc<\/code>)<\/td><td>Notepad, run as administrator<\/td><\/tr><tr><td>macOS<\/td><td><code>\/etc\/hosts<\/code> (really <code>\/private\/etc\/hosts<\/code>)<\/td><td><code>sudo nano \/etc\/hosts<\/code> in Terminal<\/td><\/tr><tr><td>Linux (Ubuntu, Debian, AlmaLinux and others)<\/td><td><code>\/etc\/hosts<\/code><\/td><td><code>sudo nano \/etc\/hosts<\/code><\/td><\/tr><tr><td>Docker containers<\/td><td><code>\/etc\/hosts<\/code>, created by Docker<\/td><td><code>docker run --add-host name=IP<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">What the hosts file does<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The hosts file is a plain text list of IP addresses and the names that should point to them. Windows, macOS and Linux all still use it. When a program asks the system for the address of a name, the operating system looks in the hosts file before asking a DNS server:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Windows:<\/strong> Microsoft&#8217;s <a href=\"https:\/\/learn.microsoft.com\/en-us\/troubleshoot\/windows-client\/networking\/troubleshoot-dns-client-resolution-issues\" target=\"_blank\" rel=\"noopener noreferrer\">DNS client troubleshooting guide<\/a> gives the order as: check the cache, check the hosts file, then send the query to the DNS server. With a hosts entry in place, no DNS query leaves the machine at all.<\/li>\n\n\n\n<li><strong>Linux:<\/strong> the order is set by the <code>hosts:<\/code> line in <code>\/etc\/nsswitch.conf<\/code>. Both the Debian 13 and Ubuntu 26.04 images we tested have <code>hosts: files dns<\/code>, meaning the file first, then DNS.<\/li>\n\n\n\n<li><strong>macOS:<\/strong> the <code>hosts(5)<\/code> manual page on macOS says the file is read by <code>mDNSResponder<\/code> and its results are returned together with those from multicast and unicast DNS.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">That makes it handy for three jobs: previewing a website on a new server before you change DNS, pointing a development name at your own machine, and blocking a site by sending its name to an address that goes nowhere.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The hosts file format<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Each line has an IP address, then the main host name, then any aliases, separated by spaces or tabs. A <code>#<\/code> starts a comment. The Linux <a href=\"https:\/\/man7.org\/linux\/man-pages\/man5\/hosts.5.html\" target=\"_blank\" rel=\"noopener noreferrer\">hosts(5) manual<\/a> describes it as &#8220;one line per IP address&#8221;, and the default Windows file explains the same rules in its comments. A typical block for testing a site on a new server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># preview the site on the new server\n192.0.2.10   example.com   www.example.com\n2001:db8::10 example.com   www.example.com<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Put both the bare domain and <code>www<\/code> on the line, or only one of them will go to the new server. If the new server has IPv6, add an IPv6 line as well; the manual allows separate IPv4 and IPv6 entries for the same host.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What does not work: we tested it<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">We added these lines to <code>\/etc\/hosts<\/code> in Debian 13 and Ubuntu 26.04 containers and looked each name up with <code>getent hosts<\/code>, which uses the same resolver as other programs. Both systems gave identical results:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>192.0.2.10   shop.example.test shop   # new server\n192.0.2.30   shop.example.test\n192.0.2.40   *.wild.example.test\n192.0.2.50   api.example.test:8080\n\nshop.example.test      192.0.2.10   shop.example.test shop\n                       192.0.2.30   shop.example.test shop\nshop                   192.0.2.10   shop.example.test shop\nSHOP.EXAMPLE.TEST      192.0.2.10   shop.example.test shop\nx.wild.example.test    (not found)\napi.example.test       (not found)<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>No wildcards.<\/strong> <code>*.wild.example.test<\/code> did not match <code>x.wild.example.test<\/code>. Every subdomain needs its own entry.<\/li>\n\n\n\n<li><strong>No ports.<\/strong> The hosts file maps names to addresses only. <code>api.example.test:8080<\/code> was simply not found; put the port in the URL instead.<\/li>\n\n\n\n<li><strong>Names are not case-sensitive,<\/strong> and aliases work: <code>shop<\/code> and <code>SHOP.EXAMPLE.TEST<\/code> both returned 192.0.2.10.<\/li>\n\n\n\n<li><strong>Duplicates cause confusion.<\/strong> With two lines for the same name, both addresses came back, because Debian and Ubuntu ship <code>\/etc\/host.conf<\/code> with <code>multi on<\/code>. The <a href=\"https:\/\/man7.org\/linux\/man-pages\/man5\/host.conf.5.html\" target=\"_blank\" rel=\"noopener noreferrer\">host.conf manual<\/a> says the default without that setting is to return only the first. Either way, keep one line per name so you know which server you are testing.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">How to edit the hosts file<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Windows<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Windows refuses changes from a normal Notepad window, even for an administrator account, with &#8220;Access to C:\\Windows\\System32\\drivers\\etc\\hosts was denied&#8221; or &#8220;Cannot create the C:\\Windows\\System32\\drivers\\etc\\hosts file&#8221;. Microsoft&#8217;s fix, in <a href=\"https:\/\/learn.microsoft.com\/en-us\/troubleshoot\/windows-server\/networking\/cannot-modify-hosts-lmhosts-files\" target=\"_blank\" rel=\"noopener noreferrer\">Can&#8217;t modify the Hosts or Lmhosts file<\/a>, applies to all versions of Windows and Windows Server:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Find Notepad in the Start menu, right-click it and select <strong>Run as administrator<\/strong>. Confirm the prompt.<\/li>\n\n\n\n<li>Choose <strong>File<\/strong>, <strong>Open<\/strong> and type <code>C:\\Windows\\System32\\drivers\\etc\\hosts<\/code> as the file name.<\/li>\n\n\n\n<li>Add your lines at the end and choose <strong>File<\/strong>, <strong>Save<\/strong>.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Keep the name exactly <code>hosts<\/code>. Microsoft&#8217;s <a href=\"https:\/\/support.microsoft.com\/en-us\/topic\/how-to-reset-the-hosts-file-back-to-the-default-c2a43f9d-e176-c6f3-e4ef-3500277a6dae\" target=\"_blank\" rel=\"noopener noreferrer\">How to reset the Hosts file back to the default<\/a> points out that a hosts file cannot have a file extension, so make sure it has not been saved as <code>hosts.txt<\/code>. That article also gives the default Windows file if yours is damaged.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Microsoft also documents that Windows Defender can flag a changed hosts file as <code>SettingsModifier:Win32\/PossibleHostsFileHijack<\/code>, because malware often edits it to redirect people to fake sites. If you did not make a change you see in the file, treat it as a warning sign.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">macOS<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Open Terminal and run <code>sudo nano \/etc\/hosts<\/code> (on our Mac, <code>nano<\/code> is a link to the <code>pico<\/code> editor). Add your lines at the end, save, and exit the editor. Leave Apple&#8217;s default block at the top alone:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>##\n# Host Database\n#\n# localhost is used to configure the loopback interface\n# when the system is booting.  Do not change this entry.\n##\n127.0.0.1\tlocalhost\n255.255.255.255\tbroadcasthost\n::1             localhost<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Linux and VPS servers<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run <code>sudo nano \/etc\/hosts<\/code>, add the line and save. In our tests the new entry was used by the very next lookup. Leave the existing lines, such as <code>localhost<\/code> and the server&#8217;s own name, where they are. Inside a Docker container, <code>\/etc\/hosts<\/code> is created by Docker and mounted into the container (our test container listed it as a separate mount), so add entries when you start the container instead. The <a href=\"https:\/\/docs.docker.com\/reference\/cli\/docker\/container\/run\/\" target=\"_blank\" rel=\"noopener noreferrer\">docker run reference<\/a> documents <code>--add-host<\/code>, which we tested:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ docker run --rm --add-host shop.example.test=192.0.2.10 alpine:3 tail -2 \/etc\/hosts\n192.0.2.10\tshop.example.test\n172.17.0.2\t5c5b98c62f5e<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">How to check the hosts file is being used<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use a tool that asks the operating system, not a DNS tool. In our Debian test, with <code>192.0.2.10 shop.example.test<\/code> in the file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ getent hosts shop.example.test\n192.0.2.10      shop.example.test\n$ dig shop.example.test | grep status\n;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NXDOMAIN, id: 24514\n$ nslookup shop.example.test\n** server can't find shop.example.test: NXDOMAIN<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>dig<\/code> and <code>nslookup<\/code> send their question straight to a DNS server, so they never see the hosts file. That is useful when you want to know what the rest of the world gets, and misleading when you are checking your own override. Programs that ask the operating system, such as curl, do follow it: curl reported <code>IPv4: 192.0.2.10<\/code> for the same name.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Linux:<\/strong> <code>getent hosts example.com<\/code><\/li>\n\n\n\n<li><strong>macOS:<\/strong> <code>dscacheutil -q host -a name example.com<\/code> (on our Mac it answered <code>localhost<\/code> from the hosts file with both 127.0.0.1 and ::1)<\/li>\n\n\n\n<li><strong>Windows:<\/strong> <code>Resolve-DnsName example.com<\/code> in PowerShell, which Microsoft&#8217;s troubleshooting guide uses to show a hosts file answer<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If the change does not show up, clear the operating system&#8217;s and the browser&#8217;s DNS cache: <a href=\"https:\/\/www.ucartz.com\/clients\/knowledgebase\/9265\/How-to-Flush-the-DNS-Cache-on-Linux-Windows-macOS-and-Browsers.html\">How to Flush the DNS Cache on Linux, Windows, macOS and Browsers<\/a> has the commands for each. For more on the DNS tools, see <a href=\"https:\/\/www.ucartz.com\/clients\/knowledgebase\/9279\/DNS-Lookup-Commands-How-to-Use-dig-nslookup-and-host.html\">DNS Lookup Commands: dig, nslookup and host<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A quicker option for one test: curl &#8211;resolve<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you only want to check one page on a new server, you do not have to touch the hosts file. The <a href=\"https:\/\/curl.se\/docs\/manpage.html\" target=\"_blank\" rel=\"noopener noreferrer\">curl manual<\/a> calls <code>--resolve<\/code> &#8220;a sort of \/etc\/hosts alternative provided on the command line&#8221;:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ curl -sv -o \/dev\/null --resolve shop.example.test:80:172.27.0.2 http:\/\/shop.example.test\/\n*   Trying 172.27.0.2:80...\n&gt; Host: shop.example.test\n&lt; HTTP\/1.1 200 OK<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The request goes to the address you give, with the right <code>Host<\/code> header, and nothing is left behind to forget. The port in <code>--resolve<\/code> must match the URL (443 for HTTPS).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Remove your test entries afterwards<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The most common hosts file problem is an old line nobody remembers. Weeks after a migration, one computer still shows the old site, or email settings point to a server that no longer exists, because the hosts file still sends that name to the old IP address. When your test is finished and DNS has been switched, delete or comment out the lines you added.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Previewing a site before a move is the classic use; <a href=\"https:\/\/www.ucartz.com\/clients\/knowledgebase\/1750\/How-to-test-your-website-before-changing-DNS.html\">How to test your website before changing DNS<\/a> walks through it. If you are moving your site to new hosting, such as <a href=\"https:\/\/www.ucartz.com\/linux-webhosting\">Ucartz web hosting<\/a>, test it on the new server with the hosts file first, then change your nameservers once everything works.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Where the hosts file is on Windows, macOS and Linux, how to edit it safely, what the format allows, and how to check that your hosts entries work.<\/p>\n","protected":false},"author":11,"featured_media":4268,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[237,400],"tags":[1138,941,1133,1137,1132,1134,1136,1135],"class_list":["post-4267","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-networking","category-tutorials","tag-curl-resolve","tag-dns","tag-etc-hosts","tag-getent","tag-hosts-file","tag-hosts-file-location","tag-mac-hosts-file","tag-windows-hosts-file"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Where Is the Hosts File? Windows, Mac and Linux\u2026 | Ucartz<\/title>\n<meta name=\"description\" content=\"Where the hosts file is on Windows, macOS and Linux, how to edit it safely, what the format allows, and how to check that your hosts entries work.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"| Ucartz Blog | Ucartz\" \/>\n<meta property=\"og:description\" content=\"Where the hosts file is on Windows, macOS and Linux, how to edit it safely, what the format allows, and how to check that your hosts entries work.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/\" \/>\n<meta property=\"og:site_name\" content=\"Ucartz Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/UcartzOnline\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-05T14:33:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-09T22:05:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/11\/hosts-file-location.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"jijosh at\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"| Ucartz Blog | Ucartz\" \/>\n<meta name=\"twitter:creator\" content=\"@ucartz\" \/>\n<meta name=\"twitter:site\" content=\"@ucartz\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"jijosh at\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@context\":\"https:\\\/\\\/schema.org\",\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/hosts-file-location\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/hosts-file-location\\\/\"},\"author\":{\"name\":\"jijosh at\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/#\\\/schema\\\/person\\\/2eef9f41e897cdc332ba03de30de2be7\"},\"headline\":\"Where Is the Hosts File? Windows, Mac and Linux Locations\",\"datePublished\":\"2026-11-05T14:33:00+00:00\",\"dateModified\":\"2026-11-09T22:05:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/hosts-file-location\\\/\"},\"wordCount\":1208,\"publisher\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/hosts-file-location\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/hosts-file-location.jpg\",\"keywords\":[\"curl resolve\",\"dns\",\"etc hosts\",\"getent\",\"hosts file\",\"hosts file location\",\"mac hosts file\",\"windows hosts file\"],\"articleSection\":[\"Networking\",\"Tutorials\"],\"inLanguage\":\"en-US\"},{\"@context\":\"https:\\\/\\\/schema.org\",\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/hosts-file-location\\\/\",\"url\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/hosts-file-location\\\/\",\"name\":\"| Ucartz Blog | Ucartz\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/hosts-file-location\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/hosts-file-location\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/hosts-file-location.jpg\",\"datePublished\":\"2026-11-05T14:33:00+00:00\",\"dateModified\":\"2026-11-09T22:05:08+00:00\",\"description\":\"Where the hosts file is on Windows, macOS and Linux, how to edit it safely, what the format allows, and how to check that your hosts entries work.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/hosts-file-location\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/hosts-file-location\\\/\"]}]},{\"@context\":\"https:\\\/\\\/schema.org\",\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/hosts-file-location\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/hosts-file-location.jpg\",\"contentUrl\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/hosts-file-location.jpg\",\"width\":1200,\"height\":630,\"caption\":\"Where Is the Hosts File? Windows, Mac and Linux Locations\"},{\"@context\":\"https:\\\/\\\/schema.org\",\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/hosts-file-location\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Where Is the Hosts File? Windows, Mac and Linux Locations\"}]},{\"@context\":\"https:\\\/\\\/schema.org\",\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/\",\"name\":\"Ucartz Blog\",\"description\":\"Guides on hosting, servers, streaming and automation\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/#organization\"},\"alternateName\":\"Ucartz\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@context\":\"https:\\\/\\\/schema.org\",\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/#organization\",\"name\":\"Ucartz Online Private Limited\",\"alternateName\":\"Ucartz\",\"url\":\"https:\\\/\\\/www.ucartz.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.ucartz.com\\\/assets\\\/images\\\/brand\\\/logo\\\/ucartz-logo-888x240.png\",\"contentUrl\":\"https:\\\/\\\/www.ucartz.com\\\/assets\\\/images\\\/brand\\\/logo\\\/ucartz-logo-888x240.png\",\"width\":888,\"height\":240,\"caption\":\"Ucartz\"},\"image\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/UcartzOnline\",\"https:\\\/\\\/twitter.com\\\/ucartz\",\"https:\\\/\\\/www.instagram.com\\\/ucartz_com\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/ucartzonline\",\"https:\\\/\\\/github.com\\\/ucartz\",\"https:\\\/\\\/n8n.io\\\/creators\\\/ucartz\\\/\",\"https:\\\/\\\/marketplace.whmcs.com\\\/group\\\/Ucartz\"]},{\"@context\":\"https:\\\/\\\/schema.org\",\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/#\\\/schema\\\/person\\\/2eef9f41e897cdc332ba03de30de2be7\",\"name\":\"jijosh at\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/wp-content\\\/themes\\\/ucartz-blog\\\/assets\\\/images\\\/authors\\\/jijosh-at-112.webp\",\"url\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/wp-content\\\/themes\\\/ucartz-blog\\\/assets\\\/images\\\/authors\\\/jijosh-at-112.webp\",\"contentUrl\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/wp-content\\\/themes\\\/ucartz-blog\\\/assets\\\/images\\\/authors\\\/jijosh-at-112.webp\",\"caption\":\"jijosh at\"},\"description\":\"I am a seasoned web hosting strategist and technical writer at Ucartz, specializing in AI, SEO, GPU servers, cloud infrastructure, and VPS hosting solutions. With over 11 years of experience in the hosting industry, he simplifies complex server technologies into actionable insights for developers, businesses, and tech enthusiasts. From performance benchmarking to real-world deployment guides, I am passionate about helping users choose the right infrastructure for modern workloads like AI, gaming, and automation.\",\"url\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/author\\\/jijosh-at\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Where Is the Hosts File? Windows, Mac and Linux\u2026 | Ucartz","description":"Where the hosts file is on Windows, macOS and Linux, how to edit it safely, what the format allows, and how to check that your hosts entries work.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/","og_locale":"en_US","og_type":"article","og_title":"| Ucartz Blog | Ucartz","og_description":"Where the hosts file is on Windows, macOS and Linux, how to edit it safely, what the format allows, and how to check that your hosts entries work.","og_url":"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/","og_site_name":"Ucartz Blog","article_publisher":"https:\/\/www.facebook.com\/UcartzOnline","article_published_time":"2026-11-05T14:33:00+00:00","article_modified_time":"2026-11-09T22:05:08+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/11\/hosts-file-location.jpg","type":"image\/jpeg"}],"author":"jijosh at","twitter_card":"summary_large_image","twitter_title":"| Ucartz Blog | Ucartz","twitter_creator":"@ucartz","twitter_site":"@ucartz","twitter_misc":{"Written by":"jijosh at","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@context":"https:\/\/schema.org","@type":"Article","@id":"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/#article","isPartOf":{"@id":"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/"},"author":{"name":"jijosh at","@id":"https:\/\/www.ucartz.com\/blog\/#\/schema\/person\/2eef9f41e897cdc332ba03de30de2be7"},"headline":"Where Is the Hosts File? Windows, Mac and Linux Locations","datePublished":"2026-11-05T14:33:00+00:00","dateModified":"2026-11-09T22:05:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/"},"wordCount":1208,"publisher":{"@id":"https:\/\/www.ucartz.com\/#organization"},"image":{"@id":"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/#primaryimage"},"thumbnailUrl":"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/11\/hosts-file-location.jpg","keywords":["curl resolve","dns","etc hosts","getent","hosts file","hosts file location","mac hosts file","windows hosts file"],"articleSection":["Networking","Tutorials"],"inLanguage":"en-US"},{"@context":"https:\/\/schema.org","@type":"WebPage","@id":"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/","url":"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/","name":"| Ucartz Blog | Ucartz","isPartOf":{"@id":"https:\/\/www.ucartz.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/#primaryimage"},"image":{"@id":"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/#primaryimage"},"thumbnailUrl":"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/11\/hosts-file-location.jpg","datePublished":"2026-11-05T14:33:00+00:00","dateModified":"2026-11-09T22:05:08+00:00","description":"Where the hosts file is on Windows, macOS and Linux, how to edit it safely, what the format allows, and how to check that your hosts entries work.","breadcrumb":{"@id":"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.ucartz.com\/blog\/hosts-file-location\/"]}]},{"@context":"https:\/\/schema.org","@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/#primaryimage","url":"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/11\/hosts-file-location.jpg","contentUrl":"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/11\/hosts-file-location.jpg","width":1200,"height":630,"caption":"Where Is the Hosts File? Windows, Mac and Linux Locations"},{"@context":"https:\/\/schema.org","@type":"BreadcrumbList","@id":"https:\/\/www.ucartz.com\/blog\/hosts-file-location\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.ucartz.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Where Is the Hosts File? Windows, Mac and Linux Locations"}]},{"@context":"https:\/\/schema.org","@type":"WebSite","@id":"https:\/\/www.ucartz.com\/blog\/#website","url":"https:\/\/www.ucartz.com\/blog\/","name":"Ucartz Blog","description":"Guides on hosting, servers, streaming and automation","publisher":{"@id":"https:\/\/www.ucartz.com\/#organization"},"alternateName":"Ucartz","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.ucartz.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@context":"https:\/\/schema.org","@type":"Organization","@id":"https:\/\/www.ucartz.com\/#organization","name":"Ucartz Online Private Limited","alternateName":"Ucartz","url":"https:\/\/www.ucartz.com\/","logo":{"@type":"ImageObject","@id":"https:\/\/www.ucartz.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.ucartz.com\/assets\/images\/brand\/logo\/ucartz-logo-888x240.png","contentUrl":"https:\/\/www.ucartz.com\/assets\/images\/brand\/logo\/ucartz-logo-888x240.png","width":888,"height":240,"caption":"Ucartz"},"image":{"@id":"https:\/\/www.ucartz.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/UcartzOnline","https:\/\/twitter.com\/ucartz","https:\/\/www.instagram.com\/ucartz_com","https:\/\/www.linkedin.com\/company\/ucartzonline","https:\/\/github.com\/ucartz","https:\/\/n8n.io\/creators\/ucartz\/","https:\/\/marketplace.whmcs.com\/group\/Ucartz"]},{"@context":"https:\/\/schema.org","@type":"Person","@id":"https:\/\/www.ucartz.com\/blog\/#\/schema\/person\/2eef9f41e897cdc332ba03de30de2be7","name":"jijosh at","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.ucartz.com\/blog\/wp-content\/themes\/ucartz-blog\/assets\/images\/authors\/jijosh-at-112.webp","url":"https:\/\/www.ucartz.com\/blog\/wp-content\/themes\/ucartz-blog\/assets\/images\/authors\/jijosh-at-112.webp","contentUrl":"https:\/\/www.ucartz.com\/blog\/wp-content\/themes\/ucartz-blog\/assets\/images\/authors\/jijosh-at-112.webp","caption":"jijosh at"},"description":"I am a seasoned web hosting strategist and technical writer at Ucartz, specializing in AI, SEO, GPU servers, cloud infrastructure, and VPS hosting solutions. With over 11 years of experience in the hosting industry, he simplifies complex server technologies into actionable insights for developers, businesses, and tech enthusiasts. From performance benchmarking to real-world deployment guides, I am passionate about helping users choose the right infrastructure for modern workloads like AI, gaming, and automation.","url":"https:\/\/www.ucartz.com\/blog\/author\/jijosh-at\/"}]}},"_links":{"self":[{"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/posts\/4267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/comments?post=4267"}],"version-history":[{"count":1,"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/posts\/4267\/revisions"}],"predecessor-version":[{"id":4270,"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/posts\/4267\/revisions\/4270"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/media\/4268"}],"wp:attachment":[{"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/media?parent=4267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/categories?post=4267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/tags?post=4267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}