{"id":632,"date":"2021-07-07T07:45:38","date_gmt":"2021-07-07T07:45:38","guid":{"rendered":"https:\/\/ownwebservers.com\/kb\/?p=632"},"modified":"2021-07-07T07:45:38","modified_gmt":"2021-07-07T07:45:38","slug":"how-to-update-hosts-file-entry-on-windows-ubuntu-and-mac","status":"publish","type":"post","link":"https:\/\/ownwebservers.com\/kb\/how-to-update-hosts-file-entry-on-windows-ubuntu-and-mac\/","title":{"rendered":"How to Update Hosts File Entry on Windows, Ubuntu and Mac"},"content":{"rendered":"<h2><strong>What is a Hosts File?<\/strong><\/h2>\n<p>You can set IP addresses for a domain on your local system through editing hosts file which will overrule the authoritative DNS. It will permit you to check, what a domain can show if it\u2019s pointed to a distinct server.<\/p>\n<p>The hosts file are going to be edited to block certain hostnames (like advertising\/malicious hosts), or used for web development functions, i.e. to redirect domains to local addresses.<\/p>\n<h3><strong>Windows<\/strong><\/h3>\n<p>To access the hosts file in Windows XP, Vista, 7, 8x, 10 you have to use the following command in the Run Line to open the file with notepad.<\/p>\n<p><strong>STEP 1:<\/strong>\u00a0Press\u00a0<strong>Windows<\/strong>\u00a0+\u00a0<strong>R<\/strong>\u00a0keys to Run Line.<\/p>\n<p><strong>STEP 2:\u00a0<\/strong>Copy the below mentioned command and paste into the Run Line.<\/p>\n<p>notepad c:\\windows\\system32\\drivers\\etc\\hosts<\/p>\n<div class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-633\" src=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-1-300x173.png\" alt=\"win-1\" width=\"455\" height=\"263\" srcset=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-1-300x173.png 300w, https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-1.png 455w\" sizes=\"auto, (max-width: 455px) 100vw, 455px\" \/><\/div>\n<div><\/div>\n<div>\n<p><strong>STEP 3:<\/strong>\u00a0When notepad is open you can edit the hosts file.<\/p>\n<p>For example, we will block Facebook. To block Facebook just enter following the line after the # mark in the hosts file.<\/p>\n<p><strong>0.0.0.0\u00a0\u00a0\u00a0 www.facebook.com<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-634\" src=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-2-300x195.png\" alt=\"win-2\" width=\"637\" height=\"414\" srcset=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-2-300x195.png 300w, https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-2.png 637w\" sizes=\"auto, (max-width: 637px) 100vw, 637px\" \/><\/p>\n<p><strong>STEP 4:<\/strong>\u00a0Now you have edited your Hosts file and save it.<\/p>\n<div class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-635\" src=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-3-300x195.png\" alt=\"win-3\" width=\"637\" height=\"414\" srcset=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-3-300x195.png 300w, https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-3.png 637w\" sizes=\"auto, (max-width: 637px) 100vw, 637px\" \/><\/div>\n<\/div>\n<div><\/div>\n<div>\n<p><strong>STEP 5:<\/strong>\u00a0Now observe if we try to reach Facebook in IE browser we can\u2019t get to the page.<\/p>\n<div class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-636\" src=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-4-300x194.png\" alt=\"win-4\" width=\"588\" height=\"380\" srcset=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-4-300x194.png 300w, https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-4.png 588w\" sizes=\"auto, (max-width: 588px) 100vw, 588px\" \/><\/div>\n<\/div>\n<div><\/div>\n<div>\n<p><strong>STEP 6:<\/strong>\u00a0We also were not able to access it in Google Chrome.<\/p>\n<div class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-637\" src=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-5-300x241.png\" alt=\"win-5\" width=\"512\" height=\"412\" srcset=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-5-300x241.png 300w, https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-5.png 512w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/div>\n<\/div>\n<div><\/div>\n<div>\n<h3><strong>Ubuntu<\/strong><\/h3>\n<\/div>\n<div>You can change within the hosts file directly through the terminal on In Ubuntu 10.04 and most Linux operating system distros. you&#8217;ll use your favored editor or maybe open your favorite GUI text editor. Like Windows 7x, Ubuntu\u2019s hosts file placed within the \/etc\/ folder, but here it&#8217;s the root of the drive. so as to edit the file, you should open it as root that is why we use sudo here.<\/div>\n<div><\/div>\n<div>\n<p><strong>STEP 1:<\/strong>\u00a0We will use VIM for this example.<\/p>\n<div class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-638\" src=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/ubuntu-1-300x215.png\" alt=\"ubuntu-1\" width=\"640\" height=\"458\" srcset=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/ubuntu-1-300x215.png 300w, https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/ubuntu-1.png 640w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/div>\n<div><\/div>\n<\/div>\n<div>\n<p><strong>STEP 2:<\/strong>\u00a0You will see that with Ubuntu there is similarly a section for IP6. For most needs, you will just need to edit it the top section and ignore the IP6.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-639\" src=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/ubuntu-2-300x291.png\" alt=\"ubuntu-2\" width=\"494\" height=\"480\" srcset=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/ubuntu-2-300x291.png 300w, https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/ubuntu-2.png 494w\" sizes=\"auto, (max-width: 494px) 100vw, 494px\" \/><\/p>\n<\/div>\n<p><strong>STEP 3:<\/strong>\u00a0Now save the file and try to open Facebook.com. Just like in windows we will see that we can\u2019t get to the page.<\/p>\n<div class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-640\" src=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/ubuntu-3-300x211.jpg\" alt=\"ubuntu-3\" width=\"513\" height=\"361\" srcset=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/ubuntu-3-300x211.jpg 300w, https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/ubuntu-3.jpg 513w\" sizes=\"auto, (max-width: 513px) 100vw, 513px\" \/><\/div>\n<div><\/div>\n<div>\n<h3><strong>Mac OS X (Any version)<\/strong><\/h3>\n<p><strong>STEP 1:<\/strong>\u00a0In Mac OS X, editing the hosts file is similar to Ubuntu. Begin in terminal and use your preferred editor or even open your favorite GUI text editor, it is easier to do so from terminal.<\/p>\n<div class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-641\" src=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/Mac-1-300x174.png\" alt=\"Mac-1\" width=\"575\" height=\"334\" srcset=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/Mac-1-300x174.png 300w, https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/Mac-1.png 575w\" sizes=\"auto, (max-width: 575px) 100vw, 575px\" \/><\/div>\n<\/div>\n<div><\/div>\n<div><strong>STEP 2:<\/strong>\u00a0The file will look like a Windows, simply with a little less explanation. Again we are going to redirect Facebook.<\/div>\n<div><\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-642\" src=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/mac-2-300x182.png\" alt=\"mac-2\" width=\"575\" height=\"348\" srcset=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/mac-2-300x182.png 300w, https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/mac-2.png 575w\" sizes=\"auto, (max-width: 575px) 100vw, 575px\" \/><\/div>\n<div><\/div>\n<div>\n<p><strong>STEP 3:<\/strong>\u00a0This time it looks like that 0.0.0.0 is a loopback and will redirect you to the PCs Apache test page.<\/p>\n<div class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-643\" src=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/mac-3-300x218.png\" alt=\"mac-3\" width=\"456\" height=\"332\" srcset=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/mac-3-300x218.png 300w, https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/mac-3.png 456w\" sizes=\"auto, (max-width: 456px) 100vw, 456px\" \/><\/div>\n<\/div>\n<div><\/div>\n<div>\n<article id=\"post-8568\" class=\"post-8568 post type-post status-publish format-standard hentry category-general ast-article-single\">\n<div class=\"ast-post-format- ast-no-thumb single-layout-1\">\n<div class=\"entry-content clear\">\n<p>If you find any difficulty with this, please feel free to get in touch with us via. Live chat or email.<\/p>\n<\/div>\n<\/div>\n<\/article>\n<nav class=\"navigation post-navigation\" role=\"navigation\" aria-label=\"Posts\"><\/nav>\n<\/div>\n<div>\n<div class=\"wp-block-image\"><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>What is a Hosts File? You can set IP addresses for a domain on your local system through editing hosts file which will overrule the authoritative DNS. It will permit you to check, what a domain can show if it\u2019s pointed to a distinct server. The hosts file are going to be edited to block [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-632","post","type-post","status-publish","format-standard","hentry","category-web-hosting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v15.2.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Update Hosts File Entry on Windows, Ubuntu and Mac - OWS KB<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ownwebservers.com\/kb\/how-to-update-hosts-file-entry-on-windows-ubuntu-and-mac\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Update Hosts File Entry on Windows, Ubuntu and Mac - OWS KB\" \/>\n<meta property=\"og:description\" content=\"What is a Hosts File? You can set IP addresses for a domain on your local system through editing hosts file which will overrule the authoritative DNS. It will permit you to check, what a domain can show if it\u2019s pointed to a distinct server. The hosts file are going to be edited to block [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ownwebservers.com\/kb\/how-to-update-hosts-file-entry-on-windows-ubuntu-and-mac\/\" \/>\n<meta property=\"og:site_name\" content=\"OWS KB\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-07T07:45:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-1-300x173.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\">\n\t<meta name=\"twitter:data1\" content=\"admin\">\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data2\" content=\"2 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/#website\",\"url\":\"https:\/\/ownwebservers.com\/kb\/\",\"name\":\"OWS KB\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/ownwebservers.com\/kb\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/how-to-update-hosts-file-entry-on-windows-ubuntu-and-mac\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/ownwebservers.com\/kb\/wp-content\/uploads\/2021\/07\/win-1.png\",\"width\":455,\"height\":263,\"caption\":\"win-1\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/how-to-update-hosts-file-entry-on-windows-ubuntu-and-mac\/#webpage\",\"url\":\"https:\/\/ownwebservers.com\/kb\/how-to-update-hosts-file-entry-on-windows-ubuntu-and-mac\/\",\"name\":\"How to Update Hosts File Entry on Windows, Ubuntu and Mac - OWS KB\",\"isPartOf\":{\"@id\":\"https:\/\/ownwebservers.com\/kb\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/ownwebservers.com\/kb\/how-to-update-hosts-file-entry-on-windows-ubuntu-and-mac\/#primaryimage\"},\"datePublished\":\"2021-07-07T07:45:38+00:00\",\"dateModified\":\"2021-07-07T07:45:38+00:00\",\"author\":{\"@id\":\"https:\/\/ownwebservers.com\/kb\/#\/schema\/person\/4a40fe3fe17a08ddd1d7c113668e75f2\"},\"breadcrumb\":{\"@id\":\"https:\/\/ownwebservers.com\/kb\/how-to-update-hosts-file-entry-on-windows-ubuntu-and-mac\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ownwebservers.com\/kb\/how-to-update-hosts-file-entry-on-windows-ubuntu-and-mac\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/how-to-update-hosts-file-entry-on-windows-ubuntu-and-mac\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/\",\"url\":\"https:\/\/ownwebservers.com\/kb\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/how-to-update-hosts-file-entry-on-windows-ubuntu-and-mac\/\",\"url\":\"https:\/\/ownwebservers.com\/kb\/how-to-update-hosts-file-entry-on-windows-ubuntu-and-mac\/\",\"name\":\"How to Update Hosts File Entry on Windows, Ubuntu and Mac\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/#\/schema\/person\/4a40fe3fe17a08ddd1d7c113668e75f2\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/ownwebservers.com\/kb\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ba5db5841d48bd7517bb2583e13983e6d2fa56a4099a0b3c61ad2daefc321303?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/ownwebservers.com\/kb\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","_links":{"self":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/632","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/comments?post=632"}],"version-history":[{"count":1,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/632\/revisions"}],"predecessor-version":[{"id":644,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/posts\/632\/revisions\/644"}],"wp:attachment":[{"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/media?parent=632"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/categories?post=632"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ownwebservers.com\/kb\/wp-json\/wp\/v2\/tags?post=632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}