HOME

TheInfoList



OR:

File attributes are a type of
metadata Metadata (or metainformation) is "data that provides information about other data", but not the content of the data itself, such as the text of a message or the image itself. There are many distinct types of metadata, including: * Descriptive ...
that describe and may modify how files 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 In nutrition science, nutrition, biology, and chemistry, fat usually means any ester of fatty acids, or a mixture of such chemical compound, compounds, most commonly those that occur in living beings or in food. The term often refers specif ...
,
NTFS NT File System (NTFS) (commonly called ''New Technology File System'') is a proprietary journaling file system developed by Microsoft in the 1990s. It was developed to overcome scalability, security and other limitations with File Allocation Tabl ...
,
ext4 ext4 (fourth extended filesystem) is a journaling file system for Linux, developed as the successor to ext3. ext4 was initially a series of backward-compatible extensions to ext3, many of them originally developed by Cluster File Systems for ...
) 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 extension A filename extension, file name extension or file extension is a suffix to the name of a computer file (for example, .txt, .mp3, .exe) that indicates a characteristic of the file contents or its intended use. A filename extension is typically d ...
s or
file system permissions Typically, a file system maintains permission settings for each stored item commonly files and directories that either grant or deny the ability to manipulate file system items. Often the settings allow controlling access based on function s ...
. In addition to files, folders,
volume Volume is a measure of regions in 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) ...
s and other file system objects may have attributes.


DOS and Windows

Traditionally, in DOS and
Microsoft Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
, 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 or organ ...
(A): When set, it indicates that the hosting file has changed since the last
backup In information technology, a backup, or data backup is a copy of computer data taken and stored elsewhere so that it may be used to restore the original after a data loss event. The verb form, referring to the process of doing so, is "wikt:back ...
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 File Explorer, previously known as Windows Explorer, is a file manager application and default desktop environment that is included with releases of the Microsoft Windows operating system from Windows 95 onwards. It provides a graphical user i ...
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 An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
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 NT File System (NTFS) (commonly called ''New Technology File System'') is a proprietary journaling file system developed by Microsoft in the 1990s. It was developed to overcome scalability, security and other limitations with File Allocation Tabl ...
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, 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 In computing, a symbolic link (also symlink or soft link) is a file whose purpose is to point to a file or directory (called the "target") by specifying a path thereto. Symbolic links are supported by POSIX and by most Unix-like operating syste ...
. * 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 OS/2 is a Proprietary software, proprietary computer operating system for x86 and PowerPC based personal computers. It was created and initially developed jointly by IBM and Microsoft, under the leadership of IBM software designer Ed Iacobucci, ...
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 PowerShell is a shell program developed by Microsoft for task automation and configuration management. As is typical for a shell, it provides a command-line interpreter for interactive use and a script interpreter for automation via a langua ...
, which has become a component of
Windows 7 Windows 7 is a major release of the Windows NT operating system developed by Microsoft. It was Software release life cycle#Release to manufacturing (RTM), released to manufacturing on July 22, 2009, and became generally available on October 22, ...
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 Windows NT is a Proprietary software, proprietary Graphical user interface, graphical operating system produced by Microsoft as part of its Windows product line, the first version of which, Windows NT 3.1, was released on July 27, 1993. Original ...
, the user must have appropriate
file system permissions Typically, a file system maintains permission settings for each stored item commonly files and directories that either grant or deny the ability to manipulate file system items. Often the settings allow controlling access based on function s ...
known as ''Write Attributes'' and ''Write Extended Attributes''.


Unix and POSIX

In
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
and Unix-like systems, including
POSIX The Portable Operating System Interface (POSIX; ) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines application programming interfaces (APIs), along with comm ...
-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, 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 the ...
(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 In information technology, a backup, or data backup is a copy of computer data taken and stored elsewhere so that it may be used to restore the original after a data loss event. The verb form, referring to the process of doing so, is "wikt:back ...
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 FreeBSD is a free-software Unix-like operating system descended from the Berkeley Software Distribution (BSD). The first version was released in 1993 developed from 386BSD, one of the first fully functional and free Unix clones on affordable ...
added some additional attributes, also supported by
DragonFly BSD DragonFly BSD is a free and open-source Unix-like operating system forked from FreeBSD 4.8. Matthew Dillon, an Amiga developer in the late 1980s and early 1990s and FreeBSD developer between 1994 and 2003, began working on DragonFly BSD in ...
: * (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 A solid-state drive (SSD) is a type of solid-state storage device that uses integrated circuits to store data persistently. It is sometimes called semiconductor storage device, solid-state device, or solid-state disk. SSDs rely on non- ...
. * (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-like operating system based on the Berkeley Software Distribution (BSD). It was the first open-source BSD descendant officially released after 386BSD was fork (software development), forked. It continues to ...
added another attribute, also supported by
OpenBSD OpenBSD is a security-focused operating system, security-focused, free software, Unix-like operating system based on the Berkeley Software Distribution (BSD). Theo de Raadt created OpenBSD in 1995 by fork (software development), forking NetBSD ...
: * (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, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
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 * (User and System) Compressed: Read-only attribute for files compressed using HFS+ Compression In these systems, the chflags 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 ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
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 command. Programs can examine and alter attributes using
ioctl In computing, ioctl (an abbreviation of input/output control) is a system call for device-specific input/output operations and other operations which cannot be expressed by regular file semantics. It takes a parameter specifying a request code; ...
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 ext4 (fourth extended filesystem) is a journaling file system for Linux, developed as the successor to ext3. ext4 was initially a series of backward-compatible extensions to ext3, many of them originally developed by Cluster File Systems for ...
,
XFS XFS is a high-performance 64-bit journaling file system created by Silicon Graphics, Inc (SGI) in 1993. It was the default file system in SGI's IRIX operating system starting with its version 5.3. XFS was ported to the Linux kernel in 2001; a ...
and
btrfs Btrfs (pronounced as "better F S", "butter F S", "b-tree F S", or "B.T.R.F.S.") is a computer storage format that combines a file system based on the copy-on-write (COW) principle with a logical volume manager (distinct from Linux's LVM), d ...
.


OpenSolaris and derivatives

Support for "system attributes" (in which the operating system defines the meaning, unlike general extended file attributes) was added to OpenSolaris in 2007 in support of the CIFS server. It has been carried forward from there into both the Oracle Solaris 11 releases and the open source
illumos Illumos (stylized as "illumos") is a partly free and open-source Unix operating system. It has been developed since 2010 and is based on OpenSolaris, after the discontinuation of that product by Oracle. It comprises a kernel, device driver ...
project. In this implementation,
wide range of attributes
can be set via the
chmod is a shell command for changing access permissions and special mode flags of files (including special files such as directories). The name is short for ''change mode'' where ''mode'' refers to the permissions and flags collectively. The co ...
command and listed by the ls command. Programs can examine and alter attributes using the getattrat and setattrat functions. Currently the
ZFS ZFS (previously Zettabyte File System) is a file system with Volume manager, volume management capabilities. It began as part of the Sun Microsystems Solaris (operating system), Solaris operating system in 2001. Large parts of Solaris, includin ...
file system supports all defined attributes, and starting in Oracle Solaris 11.2, the tmpfs file system supports a subset of attributes.


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 continues . Overview ''PC Mag ...
*
File attribute constants
in C(- runtime-library), by Microsoft Learn, 10/26/2022
File Attribute Constants
in (
Win32 The Windows API, informally WinAPI, is the foundational application programming interface (API) that allows a computer program to access the features of the Microsoft Windows operating system in which the program is running. Programs can acces ...
-) C++, by Microsoft Learn, 06/09/2023 {{DEFAULTSORT:File attribute Computer file systems