HOME

TheInfoList



OR:

File attributes are a type of meta-data that describe and may modify how
files File or filing may refer to: Mechanical tools and processes * File (tool), a tool used to ''remove'' fine amounts of material from a workpiece **Filing (metalworking), a material removal process in manufacturing ** Nail file, a tool used to gent ...
and/or directories in a filesystem behave. Typical file attributes may, for example, indicate or specify whether a file is visible, modifiable, compressed, or encrypted. The availability of most file attributes depends on support by the underlying filesystem (such as FAT, NTFS, ext4) where attribute data must be stored along with other control structures. Each attribute can have one of two states: set and cleared. Attributes are considered distinct from other metadata, such as dates and times, filename extensions or file system permissions. In addition to files, folders,
volume Volume is a measure of occupied three-dimensional space. It is often quantified numerically using SI derived units (such as the cubic metre and litre) or by various imperial or US customary units (such as the gallon, quart, cubic inch). Th ...
s and other file system objects may have attributes.


DOS and Windows

Traditionally, in DOS and
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
, files and folders accepted four attributes: *
Archive An archive is an accumulation of historical records or materials – in any medium – or the physical facility in which they are located. Archives contain primary source documents that have accumulated over the course of an individual ...
(A): When set, it indicates that the hosting file has changed since the last backup operation. Windows' file system sets this attribute on any file that has changed. Backup software then has the duty of clearing it upon a successful full or incremental backup (not a differential one). * Hidden (H): When set, indicates that the hosting file is hidden. MS-DOS commands like dir and Windows apps like File Explorer do not show hidden files by default, unless asked to do so. * System (S): When set, indicates that the hosting file is a critical system file that is necessary for the computer to operate properly. MS-DOS and Microsoft Windows use it to mark important system files. MS-DOS commands like dir and Windows apps like File Explorer do not show system files by default even when hidden files are shown, unless asked to do so. * Read-only (R): When set, indicates that a file should not be altered. Upon opening the file, file system API usually does not grant write permission to the requesting application, unless the application explicitly requests it. Read-only attributes on folders are usually ignored, being used for another purpose. As new versions of Windows came out, Microsoft has added to the inventory of available attributes on the NTFS file system, including but not limited to: * Compressed (C): When set, Windows compresses the hosting file upon storage. For more information, see . * Encrypted (E): When set, Windows encrypts the hosting file upon storage to prevent unauthorized access. For more information, see . * Not Content-Indexed (I): When set, Indexing Service or Windows Search do not include the hosting file in their indexing operation. Other attributes that are displayed in the "Attributes" column of Windows Explorer include: * Directory (D): The entry is a
subdirectory In computing, a directory is a file system cataloging structure which contains references to other computer files, and possibly other directories. On many computers, directories are known as folders, or drawers, analogous to a workbench or the t ...
, containing file and directory entries of its own. * Reparse Point (L): The file or directory has an associated re-parse point, or is a symbolic link. * Offline (O): The file data is physically moved to offline storage (Remote Storage). * Sparse (P): The file is a sparse file, i.e., its contents are partially empty and non-contiguous. * Temporary (T): The file is used for temporary storage. In DOS, OS/2 and Windows, the attrib command in cmd.exe and command.com can be used to change and display the four traditional file attributes. File Explorer in Windows can show the seven mentioned attributes but cannot set or clear the System attribute. Windows PowerShell, which has become a component of Windows 7 and later, features two commands that can read and write attributes: Get-ItemProperty and Set-ItemProperty. To change an attribute on a file on Windows NT, the user must have appropriate file system permissions known as ''Write Attributes'' and ''Write Extended Attributes''.


Unix and POSIX

In Unix and Unix-like systems, including POSIX-conforming systems, each file has a 'mode' containing 9 bit flags controlling read, write and execute permission for each of the file's owner, group and all other users (see File-system permissions §Traditional Unix permissions for more details) plus the ''setuid'' and ''setgid'' bit flags and a 'sticky' bit flag. The mode also specifies the file type (regular file, directory, or some other special kind).


4.4BSD and derivatives

In 4.4BSD and
4.4BSD-Lite The Berkeley Software Distribution or Berkeley Standard Distribution (BSD) is a discontinued operating system based on Research Unix, developed and distributed by the Computer Systems Research Group (CSRG) at the University of California, Berk ...
, files and directories (folders) accepted four attributes that could be set by the owner of the file or the
superuser In computing, the superuser is a special user account used for system administration. Depending on the operating system (OS), the actual name of this account might be root, administrator, admin or supervisor. In some cases, the actual name of t ...
(the "User" attributes) and two attributes that could only be set by the superuser (the "System" attributes): * (User) No-dump: When set, it indicates that the file or directory should not be saved during a backup operation. * (User and System) Immutable: When set, indicates that the file or directory should not be altered. Attempts to open the file for writing, create a file within the directory, remove a file from the directory, rename a file within the directory, rename the file or directory, or remove the file or directory will fail with a permissions error. * (User and System) Append-only: When set, indicates that the file should only be appended to. * (User) Opaque: When set on a directory, indicates that the directory is opaque when viewed through a union stack. FreeBSD added some additional attributes, also supported by DragonFly BSD: * (User and System) No-unlink: When set, indicates that the file or directory should not be renamed or removed. Attempts to rename or remove the file or directory will fail with a permissions error. FreeBSD also supports: * (System) No-archive: When set, indicates that the file or directory should not be archived. * (System) Snapshot: When set, indicates that the file or directory is a snapshot file. This attribute is maintained by the system, and cannot be set, even by the super-user. whereas DragonFly BSD supports: * (User and System) No-history: When set, indicates that history should not be retained for the file or directory. * (User) Swapcache: When set, indicates that clean filesystem data for the file, or for the directory and everything underneath the directory, should be cached in swap space on a solid-state drive. * (System) Swapcache: When set, indicates that clean filesystem data for the file, or for the directory and everything underneath the directory, should ''not'' be cached in swap space on a solid-state drive. * (System) Archived: When set, indicates that the file or directory may be archived.
NetBSD NetBSD is a free and open-source Unix operating system based on the Berkeley Software Distribution (BSD). It was the first open-source BSD descendant officially released after 386BSD was forked. It continues to be actively developed and is a ...
added another attribute, also supported by
OpenBSD OpenBSD is a security-focused, free and open-source, Unix-like operating system based on the Berkeley Software Distribution (BSD). Theo de Raadt created OpenBSD in 1995 by forking NetBSD 1.0. According to the website, the OpenBSD project em ...
: * (System) Archived: When set, indicates that the file or directory is archived.
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac (computer), Mac computers. Within the market of ...
added three attributes: * (User) Hidden: When set, indicates that the file or directory should not, by default, be displayed in the GUI; ls will display it, however. * (System) Restricted: When set, indicates that the file or directory will be protected by
System Integrity Protection System Integrity Protection (SIP, sometimes referred to as rootless) is a security feature of Apple's macOS operating system introduced in OS X El Capitan (2015) (OS X 10.11). It comprises a number of mechanisms that are enforced by the kernel. A ...
* (User and System) Compressed: Read-only attribute for files compressed using HFS+ Compression In these systems, the
chflags is the command in Linux that allows a user to set certain attributes of a file. is the command that displays the attributes of a file. Most BSD-like systems, including macOS, have always had an analogous command to set the attributes, bu ...
and ls commands can be used to change and display file attributes. To change a "user" attribute on a file in 4.4BSD-derived operating systems, the user must be the owner of the file or the superuser; to change a "system" attribute, the user must be the superuser.


Linux

The
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which i ...
operating system can support a wide range of file attributes that can be listed by the lsattr command and modified, where possible, by the
chattr is the command in Linux that allows a user to set certain attributes of a file. is the command that displays the attributes of a file. Most BSD-like systems, including macOS, have always had an analogous command to set the attributes, bu ...
command. Programs can examine and alter attributes using ioctl operations. Many Linux file systems support only a limited set of attributes, and none of them support every attribute that chattr can change. File systems that support at least some attributes include ext4, XFS and btrfs.


See also

* Extended file attributes * Hidden file and hidden directory * Volume label


References


External links


Definition of: DOS Attrib
on
PC Magazine ''PC Magazine'' (shortened as ''PCMag'') is an American computer magazine published by Ziff Davis. A print edition was published from 1982 to January 2009. Publication of online editions started in late 1994 and have continued to the present d ...
*
Microsoft File Attribute Constants

Win32 File Attributes
{{DEFAULTSORT:File attribute Computer file systems