{"id":12923,"date":"2024-01-12T08:11:10","date_gmt":"2024-01-12T08:11:10","guid":{"rendered":"https:\/\/www.bodhost.com\/kb\/?p=12923"},"modified":"2026-02-26T14:02:12","modified_gmt":"2026-02-26T14:02:12","slug":"how-to-flush-the-local-dns-cache-in-linux-server","status":"publish","type":"post","link":"https:\/\/www.bodhost.com\/kb\/how-to-flush-the-local-dns-cache-in-linux-server\/","title":{"rendered":"How to Clear the Local DNS Cache in a Linux Server"},"content":{"rendered":"<p>This article explains how to flush the local DNS cache in a Linux server. If your computer encounters difficulty accessing a particular website or server, it could be credited to a corrupted local DNS cache.<\/p>\n<p><strong>Follow the steps-<\/strong><\/p>\n<ol>\n<li><span class=\"TextRun SCXW43096856 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW43096856 BCX0\">Access the command line by opening your terminal.<\/span><\/span><\/li>\n<li><span class=\"TextRun SCXW90160044 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW90160044 BCX0\">Using the <\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW90160044 BCX0\">su<\/span><span class=\"NormalTextRun SCXW90160044 BCX0\"> command, log in as the root user-<\/span><\/span><span class=\"EOP SCXW90160044 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\"><br \/>\n<span class=\"TextRun SCXW115053639 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"auto\"><span class=\"NormalTextRun SpellingErrorV2Themed SCXW115053639 BCX0\">user@host<\/span><span class=\"NormalTextRun SCXW115053639 BCX0\">:~$ su<\/span><\/span><span class=\"LineBreakBlob BlobObject DragDrop SCXW115053639 BCX0\"><span class=\"SCXW115053639 BCX0\">\u00a0<\/span><br class=\"SCXW115053639 BCX0\" \/><\/span><span class=\"TextRun SCXW115053639 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW115053639 BCX0\">Password: (type your root user password here<\/span><span class=\"NormalTextRun SCXW115053639 BCX0\">)<\/span><\/span><span class=\"LineBreakBlob BlobObject DragDrop SCXW115053639 BCX0\"><span class=\"SCXW115053639 BCX0\">\u00a0<\/span><br class=\"SCXW115053639 BCX0\" \/><\/span><span class=\"TextRun SCXW115053639 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW115053639 BCX0\">root@host:<\/span><\/span><span class=\"EOP SCXW115053639 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/span><\/li>\n<li><span class=\"TextRun SCXW201571885 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW201571885 BCX0\">Restart the name service cache daemon (NSCD)-<br \/>\n<span class=\"NormalTextRun SCXW98169036 BCX0\">root@host:\u202f\/etc\/<\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW98169036 BCX0\">init.d<\/span><span class=\"NormalTextRun SCXW98169036 BCX0\">\/<\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW98169036 BCX0\">nscd<\/span><span class=\"NormalTextRun SCXW98169036 BCX0\"> restart<\/span><\/span><\/span><\/li>\n<li><span class=\"TextRun SCXW217859077 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW217859077 BCX0\">NSCD, which stands for Name Service Caching Daemon, is a commonly used DNS caching application in Linux.<\/span><\/span><\/li>\n<li><span class=\"NormalTextRun SCXW5064428 BCX0\">If you have NSCD installed, you can clear the local DNS cache for the current user by running the following co<\/span><span class=\"NormalTextRun SCXW5064428 BCX0\">mmand in your terminal or shell. To flush<\/span><span class=\"NormalTextRun SCXW5064428 BCX0\"> the local DNS cache for the current user-<br \/>\n<span class=\"NormalTextRun SCXW118206445 BCX0\">nscd &#8211;<\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW118206445 BCX0\">i<\/span><span class=\"NormalTextRun SCXW118206445 BCX0\"> hosts<\/span><\/span><\/li>\n<li><span class=\"NormalTextRun SCXW160752274 BCX0\">To flush<\/span><span class=\"NormalTextRun SCXW160752274 BCX0\"> the local DNS cache for all users-<br \/>\n<span class=\"TextRun SCXW267903112 BCX0\" lang=\"EN-IN\" xml:lang=\"EN-IN\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW267903112 BCX0\">nscd -I hosts<\/span><\/span><\/span><\/li>\n<\/ol>\n<p><span data-contrast=\"auto\">Note: The name service cache daemon (NSCD) may not come pre-installed on your Linux system. You can install it using your distribution\u2019s package manager \u2013 use yum for RedHat-based distributions like Fedora and CentOS, or apt-get for Debian-based distributions such as Ubuntu and Kubuntu.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">This way, you can flush the local DNS cache in the Linux server. If you liked our article then you will surely love our support. <\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\"> Additionally, you can discover <a href=\"https:\/\/www.bodhost.com\/kb\/how-to-manage-dns-zone-editor-in-cpanel\/\" target=\"_blank\" rel=\"noopener\">How To Manage DNS Zone Editor in cPanel<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article explains how to flush the local DNS cache in a Linux server. If your computer encounters difficulty accessing a particular website or server, it could be credited to&hellip;<\/p>\n<p><a href=\"https:\/\/www.bodhost.com\/kb\/how-to-flush-the-local-dns-cache-in-linux-server\/\" class=\"more-link\">Read More<\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[875],"tags":[973,373],"class_list":["post-12923","post","type-post","status-publish","format-standard","hentry","category-domain-name","tag-dns-cache","tag-linux-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Clear DNS Cache on Linux Like a Pro \u2013 Quick Terminal Guide<\/title>\n<meta name=\"description\" content=\"This article explains how to flush the local DNS cache in a Linux server.\" \/>\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.bodhost.com\/kb\/how-to-flush-the-local-dns-cache-in-linux-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Clear DNS Cache on Linux Like a Pro \u2013 Quick Terminal Guide\" \/>\n<meta property=\"og:description\" content=\"This article explains how to flush the local DNS cache in a Linux server.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bodhost.com\/kb\/how-to-flush-the-local-dns-cache-in-linux-server\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - bodHOST\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-12T08:11:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-26T14:02:12+00:00\" \/>\n<meta name=\"author\" content=\"Paul Lopez\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paul Lopez\" \/>\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\":\"Article\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-flush-the-local-dns-cache-in-linux-server\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-flush-the-local-dns-cache-in-linux-server\\\/\"},\"author\":{\"name\":\"Paul Lopez\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/566ccff9a2fae4af852be8097b179813\"},\"headline\":\"How to Clear the Local DNS Cache in a Linux Server\",\"datePublished\":\"2024-01-12T08:11:10+00:00\",\"dateModified\":\"2026-02-26T14:02:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-flush-the-local-dns-cache-in-linux-server\\\/\"},\"wordCount\":245,\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"keywords\":[\"DNS cache\",\"Linux Server\"],\"articleSection\":[\"Domain Name\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-flush-the-local-dns-cache-in-linux-server\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-flush-the-local-dns-cache-in-linux-server\\\/\",\"name\":\"Clear DNS Cache on Linux Like a Pro \u2013 Quick Terminal Guide\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\"},\"datePublished\":\"2024-01-12T08:11:10+00:00\",\"dateModified\":\"2026-02-26T14:02:12+00:00\",\"description\":\"This article explains how to flush the local DNS cache in a Linux server.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-flush-the-local-dns-cache-in-linux-server\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-flush-the-local-dns-cache-in-linux-server\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/how-to-flush-the-local-dns-cache-in-linux-server\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Domain Name\",\"item\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/category\\\/domain-name\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Clear the Local DNS Cache in a Linux Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"alternateName\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"contentUrl\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"width\":240,\"height\":240,\"caption\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/566ccff9a2fae4af852be8097b179813\",\"name\":\"Paul Lopez\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c63d9f5400cd5ef87b481a24b2c1a4fb89f1674b6391325326cf13f1e735dff8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c63d9f5400cd5ef87b481a24b2c1a4fb89f1674b6391325326cf13f1e735dff8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c63d9f5400cd5ef87b481a24b2c1a4fb89f1674b6391325326cf13f1e735dff8?s=96&d=mm&r=g\",\"caption\":\"Paul Lopez\"},\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/author\\\/paullopez\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Clear DNS Cache on Linux Like a Pro \u2013 Quick Terminal Guide","description":"This article explains how to flush the local DNS cache in a Linux server.","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.bodhost.com\/kb\/how-to-flush-the-local-dns-cache-in-linux-server\/","og_locale":"en_US","og_type":"article","og_title":"Clear DNS Cache on Linux Like a Pro \u2013 Quick Terminal Guide","og_description":"This article explains how to flush the local DNS cache in a Linux server.","og_url":"https:\/\/www.bodhost.com\/kb\/how-to-flush-the-local-dns-cache-in-linux-server\/","og_site_name":"Knowledge Base - bodHOST","article_published_time":"2024-01-12T08:11:10+00:00","article_modified_time":"2026-02-26T14:02:12+00:00","author":"Paul Lopez","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Paul Lopez","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bodhost.com\/kb\/how-to-flush-the-local-dns-cache-in-linux-server\/#article","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-flush-the-local-dns-cache-in-linux-server\/"},"author":{"name":"Paul Lopez","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/566ccff9a2fae4af852be8097b179813"},"headline":"How to Clear the Local DNS Cache in a Linux Server","datePublished":"2024-01-12T08:11:10+00:00","dateModified":"2026-02-26T14:02:12+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-flush-the-local-dns-cache-in-linux-server\/"},"wordCount":245,"publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"keywords":["DNS cache","Linux Server"],"articleSection":["Domain Name"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.bodhost.com\/kb\/how-to-flush-the-local-dns-cache-in-linux-server\/","url":"https:\/\/www.bodhost.com\/kb\/how-to-flush-the-local-dns-cache-in-linux-server\/","name":"Clear DNS Cache on Linux Like a Pro \u2013 Quick Terminal Guide","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/#website"},"datePublished":"2024-01-12T08:11:10+00:00","dateModified":"2026-02-26T14:02:12+00:00","description":"This article explains how to flush the local DNS cache in a Linux server.","breadcrumb":{"@id":"https:\/\/www.bodhost.com\/kb\/how-to-flush-the-local-dns-cache-in-linux-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bodhost.com\/kb\/how-to-flush-the-local-dns-cache-in-linux-server\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.bodhost.com\/kb\/how-to-flush-the-local-dns-cache-in-linux-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Domain Name","item":"https:\/\/www.bodhost.com\/kb\/category\/domain-name\/"},{"@type":"ListItem","position":2,"name":"How to Clear the Local DNS Cache in a Linux Server"}]},{"@type":"WebSite","@id":"https:\/\/www.bodhost.com\/kb\/#website","url":"https:\/\/www.bodhost.com\/kb\/","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","description":"","publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"alternateName":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bodhost.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.bodhost.com\/kb\/#organization","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","url":"https:\/\/www.bodhost.com\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","contentUrl":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","width":240,"height":240,"caption":"Web Hosting Knowledge Base | bodHOST Hosting FAQ"},"image":{"@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/566ccff9a2fae4af852be8097b179813","name":"Paul Lopez","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c63d9f5400cd5ef87b481a24b2c1a4fb89f1674b6391325326cf13f1e735dff8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c63d9f5400cd5ef87b481a24b2c1a4fb89f1674b6391325326cf13f1e735dff8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c63d9f5400cd5ef87b481a24b2c1a4fb89f1674b6391325326cf13f1e735dff8?s=96&d=mm&r=g","caption":"Paul Lopez"},"url":"https:\/\/www.bodhost.com\/kb\/author\/paullopez\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/12923","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/comments?post=12923"}],"version-history":[{"count":4,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/12923\/revisions"}],"predecessor-version":[{"id":13669,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/12923\/revisions\/13669"}],"wp:attachment":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/media?parent=12923"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/categories?post=12923"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/tags?post=12923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}