Hidden file and hidden directory

Short description: File system object that is not displayed by default

"Dot file" redirects here. For the computer language which uses the .dot extension, see DOT (graph description language).

In computing, a hidden file or hidden directory is a file system object (such as a file or directory) that is excluded from a directory content report unless explicitly requested. The value of hiding files is generally to avoid showing the user files that are not likely to be of interest to them. The feature is not a security mechanism because access is not restricted; the user can request that normally-hidden files be displayed. Hiding is a feature of the programs that display file system objects; not inherently with either the operating or file systems.[1][2][3][4]

## Contents

* 1 Unix and Unix-like environments
* 1.1 Android
* 1.2 GNOME
* 1.3 macOS
* 2 Windows and DOS
* 2.1 Command Prompt
* 2.2 File Explorer
* 3 PowerShell (cross-platform)
* 4 References
* 5 External links

## Unix and Unix-like environments

The Unix-based `ls` shell command hides any file that starts with a dot (commonly called a dot file or dotfile) unless the option `-a` or `-A` is specified. [5] Even with wildcard matching, the command does not match a dotfile unless the expression starts with `.` For example, `*f*` does not match `.foo`, but `.f*` does.

According to Rob Pike, dotfiles were an unintended consequence of the implementation of the hierarchical file system during the Unix 2nd Edition re-write, which introduced `.` as a name in a directory that refers to the directory itself and `..` as a name in a directory that refers to its parent directory. In order to exclude those two entries from `ls` output, all entries prefixed with `.` were omitted. This meant that any file or directory could be excluded from the output of `ls` by giving it a file name with `.` as the first character.[6]

Commonly, user-specific application configuration information is stored in the user's home directory as a dotfile. Notable dotfiles include startup shell scripts such as `.profile`, `.login`, and `.cshrc` as well as `.plan` and `.project` which are used by the `finger` and `name` commands.[7] Many applications, from bash to desktop environments such as GNOME, store user-specific configuration this way, but the XDG Base Directory Specification aims to migrate such config files to be non-hidden (not starting with `.`) but stored in a hidden directory `$HOME/.config`.[8]

### Android

The Android operating system provides empty .nomedia files as a hint to apps to exclude the content of the folder. This convention prevents photo and music files from appearing in picture galleries or played in MP3 player apps. This is useful to prevent downloaded voicemail files from playing between the songs in a playlist and to keep personal photos private while still allowing those in other folders to be shared freely.

This convention is not enforced by the file or operating systems. Each app is responsible for following the convention.

### GNOME

File:Screenshot Nautilus hidden file.pngGNOME Files featuring a hidden directory

In the GNOME desktop environment (as well as programs using GLib[9]), filenames listed in a file named .hidden are excluded from the directory containing the file. In the file manager, keyboard shortcut includes both dotfiles and files listed in .hidden.

### macOS

In addition to the dotfile behaviour, files with the invisible attribute are excluded by Finder although not by `ls`.

The invisible attribute can be set or cleared via the `SetFile` command. For example, command line `SetFile -a V jimbo` hides the file jimbo.[10] Starting in Snow Leopard, the `chflags` command can also be used. For example, `chflags hidden jimbo` is equivalent.[11]

## Windows and DOS

The FAT, NTFS, and ReFS file systems, which have originated from DOS and Windows, maintain two file attributes called "hidden" and a "system" for each item. Items with these attributes are hidden.

### Command Prompt

In Windows Command Prompt, the `dir` command excludes items that have either the "hidden" or "system" attributes. If invoked with the `/a` command-line switch, the command shows all items, even the hidden ones. It's variations, `/as` and `/ah` respectively display files with "system" and "hidden" attributes.

The `attrib.exe` command-line utility, included will all versions of MS-DOS and Windows, can set or clear attributes.

### File Explorer

File Explorer controls visibility based on user settings that are accessible from its toolbar (or via the Control Panel). By Default, File Explorer excludes items with the "hidden" attribute, but can reveal them if the "Show hidden files, folders, or drives" is set. Items with the "System" attribute remain hidden unless another setting, called "Hide protected operating system files (Recommended)," is cleared. File Explorer renders the icons of hidden items semi-transparently.

A Windows Shell hack allows one to hide the content of a folder by suffixing a pre-defined CLSID to its name.[12] The folder is still visible in File Explorer, but its content becomes one of the Windows special folders.[13] This hack is restricted to File Explorer and Windows Shell API. Any app that doesn't use the Shell API (including the bundled Windows Command Prompt and PowerShell) can see the folder, its name, and its content.

## PowerShell (cross-platform)

PowerShell started out as the successor Windows Command Prompt for Microsoft Windows, but is now a cross-platform, free, and open-source shell.

The `Get-ChildItem` cmdlet, by default, doesn't display hidden items, unless configured to do so via parameters. With the `-Force` parameter, the cmdlet displays all items, including hidden ones. With the `-Hidden` parameter, the cmdlet displays only hidden items, excluding ordinary items. The cmdlet also features a `-Attributes` parameters that allows granular filtering by specific attributes.

The `Get-ItemProperty` and `Set-ItemProperty` cmdlets can query or modify the `Attributes` property of each file or directory.

## References

1. ↑ "What is a hidden file?". http://windows.microsoft.com/en-nz/windows/what-is-hidden-file.
2. ↑ "Configuring X: What are all those dotfiles for anyway?". Linux Focus. March 1998. http://new.linuxfocus.org/English/March1998/article24.html.
3. ↑ "Sample .bashrc and .bash_profile Files". Linux Documentation Project. http://tldp.org/LDP/abs/html/sample-bashrc.html.
4. ↑ Subodh Soni (2001-12-01). "Understanding Linux configuration files". https://www.ibm.com/developerworks/library/l-config/index.html.
5. ↑ "ls(1) - Linux man page". linux.die.net. https://linux.die.net/man/1/ls.
6. ↑ Rob Pike (August 3, 2012). "A lesson in shortcuts.". Google Plus. https://plus.google.com/+RobPikeTheHuman/posts/R58WgWwN9jp.
7. ↑ One user could lookup another by using the command along with the username (and hostname if not on the local host), and the finger service would respond with the other user's current status, and the contents of the `.plan` and `.project` files in that user's `$HOME` folder.
8. ↑ Bastian, Waldo; Lortie, Ryan; Poettering, Lennart (November 24, 2010). "XDG Base Directory Specification". http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html.
9. ↑ "GLib commit: Support for .hidden files". 28 November 2012. https://git.gnome.org/browse/glib/commit/?id=510ba9b4efe1813e24c6dfa7405c3547bf9efdd7.
10. ↑ `SetFile(1)` – Darwin and macOS General Commands Manual
11. ↑ `chflags(1)` – Darwin and macOS General Commands Manual
12. ↑ "Canonical Names of Control Panel Items - Win32 apps" (in en-us). 29 April 2022. https://docs.microsoft.com/en-us/windows/win32/shell/controlpanel-canonical-names?redirectedfrom=MSDN.
13. ↑ "The Secret BEHIND the Windows 7 GodMode". 5 January 2010. https://www.thewindowsclub.com/the-secret-behind-the-windows-7-godmode.

## External links

* Bellevue Linux Users Group:
* Computer Hope: Microsoft DOS attrib command
* .NOMEDIA file

* v
* t
* e

Computer files

Types|

* Binary file / text file
* File format
* List of file formats
* File signatures
* Magic number
* Metafile
* Sidecar file
* Sparse file
* Swap file
* System file
* Temporary file
* Zero-byte file

Properties|

* Filename
* 8.3 filename
* Long filename
* Filename mangling
* Filename extension
* List of filename extensions
* File attribute
* Extended file attributes
* File size
* Hidden file / Hidden directory

Organisation|

* Directory/folder
* NTFS junction point
* Temporary folder
* Directory structure
* File sequence
* File system
* Filesystem Hierarchy Standard
* Path

Operations|

* Open
* Close
* Read
* Write

Linking|

* Alias
* File descriptor
* Hard link
* Shadow
* Shortcut
* Symbolic link

Management|

* File comparison
* File compression
* File manager
* Comparison of file managers
* File system permissions
* File transfer
* File sharing
* File verification

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Hidden file and hidden directory. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Hidden_file_and_hidden_directory&oldid=3980288"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template