File attribute

Also known as: file attributes

On this page 7

A file attribute is a piece of metadata stored by the file system alongside a file or directory that describes a property of that item or controls how the operating system handles it, for example whether it is read-only, hidden or compressed. In OS storage, file attributes sit next to the file name, size and timestamps in the directory entry or file record, and they are distinct from the file’s actual content.

Across operating systems, the term covers both the classic single-bit flags introduced by DOS and FAT and richer properties found in modern file systems such as NTFS, APFS and ext4. Understanding which attributes a file system supports explains many everyday behaviors, from files that refuse to be deleted to data that loses its properties when copied to a USB drive.

How file systems store attributes

File systems store attributes in the per-file metadata structure that describes each item. On FAT32 and exFAT this is the directory entry, which reserves an attribute byte of individual bits. On NTFS it is the Master File Table record, and on ext4 and other Unix file systems it is the inode.

NTFS takes the idea furthest: in NTFS, almost everything about a file is an attribute, including the name and even the data itself, stored as the $DATA attribute. The familiar flags such as read-only and hidden live in the $STANDARD_INFORMATION attribute as a 32-bit field of bit values.

The table below lists the classic attributes that Windows and FAT-family file systems expose.

AttributeLetter in attribEffect
Read-onlyRPrevents modification or deletion by ordinary operations
HiddenHExcludes the item from default directory listings
SystemSMarks a file used by the operating system
ArchiveASignals that the file changed since the last backup
DirectoryNone, set by the systemIdentifies the entry as a folder
Not content indexedIExcludes the file from the search indexer
Classic DOS and Windows file attributes

Extended attributes in NTFS, APFS and ext4

Modern file systems add attributes that change how data is stored, not only how it is displayed. NTFS supports compressed, encrypted, sparse, temporary and offline flags, and a reparse point attribute that implements symbolic links, junctions and cloud placeholder files.

Beyond flags, most current file systems support extended attributes, often abbreviated xattrs: named key and value pairs attached to a file. macOS stores the com.apple.quarantine attribute on downloaded files, Linux uses security.selinux for SELinux labels, and Windows uses an alternate data stream called Zone.Identifier to mark files from the internet.

File systemBasic flagsExtended attributesNotable special attributes
FAT32Yes, one byteNoNone beyond the classic set
exFATYesNoNone beyond the classic set
NTFSYes, 32-bit fieldYes, through streams and EAsCompressed, encrypted, sparse, reparse point
ext4Yes, through chattr flagsYes, xattrsImmutable, append-only
APFSYes, BSD flagsYes, xattrsCompressed, hidden, immutable
Attribute support across common file systems

File attributes compared with permissions

File attributes are often confused with access permissions, but the two answer different questions. Permissions decide who may read, write or execute a file, whereas attributes describe what the file is or how the system should treat it for everyone.

The difference matters in practice. A Windows read-only attribute can be cleared by any user who has write permission, so it is a safeguard against accidents, not a security control. By contrast, the Linux immutable flag, set with chattr +i, blocks changes even by root until a privileged user removes it.

Metadata typeQuestion it answersExample
File attributeHow should the system treat this fileHidden, archive, compressed
Permission or ACLWho may access it and howRead and write for one group
TimestampWhen was it created, changed or accessedLast modified time
Extended attributeWhat extra labeled data belongs to itQuarantine or security label
Attributes versus related metadata

Viewing and changing file attributes

Every desktop platform offers both graphical and command-line tools for attributes. On Windows, the Properties dialog shows read-only and hidden, while the attrib command and PowerShell expose the full set. On Linux, lsattr and chattr manage inode flags, and getfattr and setfattr handle xattrs.

On macOS, chflags sets BSD flags such as hidden and uchg, and xattr lists or removes extended attributes. Administrators frequently use xattr -d com.apple.quarantine to clear the download quarantine on a trusted file, which should be done only after verifying its origin.

Common problems and pitfalls

Most attribute problems arise when files move between file systems with different capabilities. The table below maps typical symptoms to their causes.

SymptomLikely causeFix
File cannot be deleted on Linux even as rootImmutable flag setRemove it with chattr -i
Downloaded script shows a security warningMark of the web stream presentUnblock it after verifying the source
Encryption or labels lost after copyingTarget is FAT32 or exFATCopy to a file system that supports them
Folder appears emptyFiles carry the hidden attributeEnable display of hidden items
Backup copies every file each timeArchive bit not cleared by the toolUse a backup mode that resets it
Attribute-related symptoms and fixes

A related pitfall is relying on the hidden attribute for secrecy. Hidden files are skipped only by default views; any user who enables hidden items, or uses a terminal, sees them immediately, so confidential data needs permissions or encryption instead.

The simple explanation

A file attribute is a small label the computer keeps on each file. The label might say “do not change me”, “do not show me in the normal list” or “I have changed since the last backup”.

It works like sticky notes on folders in a filing cabinet. The note does not change what is inside the folder, but it tells everyone how to handle it. The main lesson: these labels help with organization and preventing accidents, but they are not locks, and some of them disappear when files are copied to a simple USB stick.

How it is used in practice

A systems administrator manages a Linux web server where an attacker once modified the main configuration file. To prevent a repeat, the administrator sets the immutable flag on the critical configuration files with chattr +i. Even a compromised process running as root now receives an “Operation not permitted” error when it tries to overwrite them.

When a legitimate change is needed, the administrator removes the flag, edits the file, tests the service and sets the flag again, recording each step in the change log. The same team also discovers that log archives copied to an exFAT external drive have lost their SELinux labels, so it moves the archive target to an ext4 volume. Unauthorized configuration changes stop, and restored files keep their security context.