{"id":152351,"date":"2025-01-12T21:06:47","date_gmt":"2025-01-12T21:06:47","guid":{"rendered":"https:\/\/linuxiac.com\/?p=152351"},"modified":"2025-01-12T21:54:04","modified_gmt":"2025-01-12T21:54:04","slug":"hidden-files-in-linux-explained","status":"publish","type":"post","link":"https:\/\/linuxiac.com\/hidden-files-in-linux-explained\/","title":{"rendered":"Hidden Files in Linux Explained"},"content":{"rendered":"\n<p>If you&#8217;re new to the world of Linux, you&#8217;ve probably encountered the term &#8220;hidden files&#8221; quite often. But why are they actually? Are they secrets, mistakes, or just forgotten relics of the system? Well, it\u2019s none of the above. In fact, as you will see below, they are something quite simple.<\/p>\n\n\n\n<p>In this article, we\u2019ll unravel the mystery of hidden files in Linux. We&#8217;ll cover what they are, how to find them, and why you shouldn\u2019t just delete them all willy-nilly (seriously, don\u2019t do that) because they perform important functions &#8211; otherwise, they wouldn&#8217;t be <em>hidden<\/em>, would they?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Are Hidden Files in Linux?<\/h2>\n\n\n\n<p>Hidden files in Linux (commonly referred to as <strong>dotfiles<\/strong>) are exactly the same thing as regular files, except for one small difference: <strong>their names start with a dot (.)<\/strong>. That\u2019s it! For example, a file named &#8220;<em>.example.txt<\/em>&#8221; is considered hidden, while a file called &#8220;<em>example.txt<\/em>&#8221; is not.<\/p>\n\n\n\n<p>In other words, these aren\u2019t special magic files\u2014they\u2019re just like any other file on your system, except for their hidden nature.<\/p>\n\n\n\n<p>The next big question is: Why are they hidden? Believe it or not, the answer is surprisingly simple\u2014it&#8217;s all about reducing clutter.<\/p>\n\n\n\n<p>Most hidden files store configuration data, preferences, or settings for applications and the operating system you don\u2019t interact with daily. For example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&#8220;<em>.ssh<\/em>&#8221; is where your SSH keys and configurations live.<\/li>\n\n\n\n<li>The &#8220;<em>.bashrc<\/em>&#8221; file contains settings for your Bash shell.<\/li>\n\n\n\n<li>&#8220;<em>.config<\/em>&#8221; holds configuration data for various applications.<\/li>\n<\/ul>\n\n\n\n<p>In most cases (though not all), their content isn\u2019t meant to be directly edited by the user\u2014unless they\u2019re sure what they\u2019re doing. Instead, it\u2019s typically updated behind the scenes by various applications or the operating system itself.<\/p>\n\n\n\n<p>Keeping them hidden minimizes the risk of accidental changes or deletions, which could cause problems if something important gets deleted or modified.<\/p>\n\n\n\n<p>Lastly, something you\u2019ll want to remember crystal clear\u2014<strong>hidden files in Linux do not inherently provide any security benefits<\/strong> because their &#8220;hidden&#8221; status is merely a naming convention.<\/p>\n\n\n\n<p>Files or directories that start with a dot (.) are simply excluded from the default <code>ls<\/code> command output and GUI file manager views. However, this doesn\u2019t prevent anyone from finding or accessing them.<\/p>\n\n\n\n<p>Therefore, always use proper security measures such as file permissions, encryption, or restricted access for true security.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to List Hidden Files?<\/h2>\n\n\n\n<p>Listing hidden files is super easy. In the terminal, add the &#8220;<em>-a<\/em>&#8221; option, responsible for showing all files, including hidden files and directories, to the well-known <code>ls -l<\/code> command, which, as we know, lists the contents of a directory in a long format.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">ls -la<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-01.jpg\"><img decoding=\"async\" width=\"1024\" height=\"613\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-01.jpg\" alt=\"Show hidden files and directories in Linux.\" class=\"wp-image-152387\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-01.jpg 1024w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-01-380x227.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-01-768x460.jpg 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Show hidden files and directories in Linux.<\/figcaption><\/figure>\n\n\n\n<p>And just like that, the magic happens. This tiny dot at the beginning of a file or folder name signals to Linux that this file (or directory) should be \u201cinvisible\u201d by default.<\/p>\n\n\n\n<p>Wait, did I say directory? Don&#8217;t worry! The same rules apply\u2014everything I mentioned about hidden files also goes for hidden directories, with no exceptions.<\/p>\n\n\n\n<p>In other words, they follow the same rule: any directory prefixed with a dot (.) at the beginning of its name is considered hidden in Linux. It is just a folder that Linux prefers to keep out of sight by default &#8211; there&#8217;s nothing unique or different about it compared to other &#8220;visible&#8221; directories.<\/p>\n\n\n\n<p>For example, in your home directory, you might see these hidden directories if you reveal them:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><em>.config<\/em><\/li>\n\n\n\n<li><em>.local<\/em><\/li>\n\n\n\n<li><em>.cache<\/em><\/li>\n<\/ul>\n\n\n\n<p>Just like hidden files, these directories are used to store configuration files, user preferences, or cache data for applications and the operating system.<\/p>\n\n\n\n<p>Here&#8217;s a neat little trick: if you want to list only the hidden files and directories in the current directory, here&#8217;s how you can do it:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">ls -ld .?*<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-07.jpg\"><img decoding=\"async\" width=\"962\" height=\"315\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-07.jpg\" alt=\"Show only hidden files and directories on Linux.\" class=\"wp-image-152447\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-07.jpg 962w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-07-380x124.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-07-768x251.jpg 768w\" sizes=\"(max-width: 962px) 100vw, 962px\" \/><\/a><figcaption class=\"wp-element-caption\">Show only hidden files and directories on Linux.<\/figcaption><\/figure>\n\n\n\n<p>And now, let me show you how to view all the hidden files and directories using your desktop environment&#8217;s file manager. Whether you&#8217;re using GNOME\u2019s Files, KDE\u2019s Dolphin, or any other file manager, most of them use the same shortcut: <strong>Ctrl + H<\/strong>. Just press that, and you&#8217;ll be able to toggle hidden files and directories on or off easily.<\/p>\n\n\n\n<p>Here&#8217;s how the file manager displays the contents of the user&#8217;s directory by default:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-04.jpg\"><img decoding=\"async\" width=\"1024\" height=\"584\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-04-1024x584.jpg\" alt=\"File manager's default view.\" class=\"wp-image-152414\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-04-1024x584.jpg 1024w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-04-380x217.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-04-768x438.jpg 768w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-04.jpg 1068w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">File manager&#8217;s default view.<\/figcaption><\/figure>\n\n\n\n<p>And here&#8217;s what happens when you press &#8220;<em>Ctrl + H<\/em>&#8220;: all hidden files and directories become visible. To hide them again, press the shortcut once more.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-06.jpg\"><img decoding=\"async\" width=\"1024\" height=\"584\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-06-1024x584.jpg\" alt=\"The file manager shows all hidden files and directories.\" class=\"wp-image-152423\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-06-1024x584.jpg 1024w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-06-380x217.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-06-768x438.jpg 768w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/01\/linux-hidden-files-explained-06.jpg 1068w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">The file manager shows all hidden files and directories.<\/figcaption><\/figure>\n\n\n\n<p><span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\">The\u00a0<a href=\"https:\/\/linuxiac.com\/find-files-in-linux\/\" target=\"_blank\">find command<\/a>\u00a0is also\u00a0<\/span>a powerful tool for searching files; you can use it to locate hidden files specifically. The example below searches for all files and directories in the current directory, starting with a dot (.) &#8211; as we already know, the hidden files convention.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">find . -name <span class=\"hljs-string\">\".*\"<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Creating a Hidden File in Linux<\/h2>\n\n\n\n<p>The simplest way to create a hidden file is by adding a dot (.) at the beginning of the file name when you create it.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">touch .myhiddenfile<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>For directories, the approach works the same way. Again, it\u2019s all about following the naming convention: just add a dot before the name.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">mkdir .myhiddendir<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Finally, if you already have a file that you want to hide, simply rename it to start with a dot.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">mv myfile .myfile<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Wrapping It Up<\/h2>\n\n\n\n<p>Hidden files in Linux play an important role in keeping your system organized. Now that you know what they are, go ahead and put this knowledge to good use in your Linux workflow.<\/p>\n\n\n\n<p>The key thing to remember about hidden files is that they\u2019re just regular files with a special naming convention\u2014their names always start with a dot. And while the term &#8220;hidden&#8221; might suggest some level of security, these files don\u2019t provide any.<\/p>\n\n\n\n<p>So, next time you press &#8220;<em>Ctrl + H<\/em>&#8221; or type <code>ls -la<\/code>, you\u2019ll know exactly what\u2019s happening. Thanks for your time, and happy exploring!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn all about hidden files in Linux, why they exist, how to view them, and how to manage them effectively for better control over your system.<\/p>\n","protected":false},"author":10,"featured_media":152354,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4420,4417],"tags":[6263],"class_list":["post-152351","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-general","category-linux-knowledge","tag-hidden-files"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/posts\/152351","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/comments?post=152351"}],"version-history":[{"count":0,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/posts\/152351\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/media\/152354"}],"wp:attachment":[{"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/media?parent=152351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/categories?post=152351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/tags?post=152351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}