Hidden file and hidden directory

From Wikipedia, the free encyclopedia
Jump to: navigation, search

In computing, a hidden directory or hidden file is a directory (folder) or file which file system utilities do not display by default. They are commonly used for storing user preferences or preserving the state of a utility and are frequently created implicitly by using various utilities. Usually the intent is to not "clutter" the display of the contents of a directory with files the user did not create.[1][2][3]

Unix and Unix-like environments[edit]

In Unix-like operating systems any file or directory that starts with a period or full stop character (for example, /home/user/.config) is to be treated as hidden – that is, the ls command does not display them unless the -a flag (ls -a) is used.

In most command line shells, wildcards will not match files whose names start with . unless the wildcard itself starts with an explicit . (although this is sometimes configurable; for example, the dotglob[4] option in bash).

According to Rob Pike, the notion that filenames preceded by a . should be hidden in Unix was probably an unintended consequence of trying to make ls not show . and ... To avoid showing . and .., a simple test to exclude any file whose name started with a . character, rather than the exact names . and .., was added to ls, and that happened to make all files starting with . hidden.[5] The convention of putting lots of hidden dotfiles directly in the home directory was considered bad design by Rob Pike and other Plan 9 developers, and they consequently put user config files in $HOME/cfg and $HOME/lib in Plan 9.[5] The Unix/Linux freedesktop.org XDG Base Directory Specification also aims to migrate user config files from dotfiles in $HOME to non-hidden files in $HOME/.config.[6]


In the GNOME desktop environment (as well as all programs written using GLib[7]), filenames listed in a file named .hidden in each directory are also excluded from display. In GNOME's file manager, the keyboard shortcut Ctrl+H enables the display of both kinds of hidden files.

Mac OS X[edit]

In addition to the "dotfile" behaviour, files with the "Invisible" attribute are hidden in Finder, although not in ls. The "Invisible" attribute can be set or cleared using the SetFile command; for example, invoking SetFile -a V jimbo will hide the file "jimbo".[8] Starting in Mac OS X Snow Leopard, the chflags command can also be used; for example, chflags hidden jimbo will hide the file "jimbo".[9]

DOS and MS Windows[edit]

In MS-DOS and other DOS systems, file directory entries include a Hidden File attribute which is manipulated using attrib command. Use the command line command dir /ah to display the files with the attribute of hidden.

Under Windows Explorer, content of a directory can be hidden just by appending a pre-defined CLSID [10] to the end of the folder name. The directory is still visible, but its content becomes one of the Windows Special Folders.[11] However, the real content of this directory can still be seen using CLI command dir.


Malicious programs can use this functionality to hide their presence.


  1. ^ "Configuring X: What are all those dotfiles for anyway?". Linux Focus. March 1998. Retrieved 2013-09-08. 
  2. ^ "Sample .bashrc and .bash_profile Files". Linux Documentation Project. 
  3. ^ "Understanding Linux configuration files". IBM.com. Retrieved 2012-02-13. 
  4. ^ "Bash Reference Manual". 3.5.8 Filename Expansion. Retrieved January 23, 2014. 
  5. ^ a b Rob Pike. "A lesson in shortcuts.". Google Plus. 
  6. ^ Bastian, Waldo; Lortie, Ryan; Poettering, Lennart (November 24, 2010). "XDG Base Directory Specification". Retrieved June 4, 2014. 
  7. ^ "GLib commit: Support for .hidden files". Retrieved 2013-08-07. 
  8. ^ SetFile(1) – Darwin and Mac OS X General Commands Manual
  9. ^ chflags(1) – Darwin and Mac OS X General Commands Manual
  10. ^ Canonical Names of Control Panel Items
  11. ^ The Secret BEHIND the Windows 7 “GodMode”

External links[edit]