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.
| Attribute | Letter in attrib | Effect |
|---|---|---|
| Read-only | R | Prevents modification or deletion by ordinary operations |
| Hidden | H | Excludes the item from default directory listings |
| System | S | Marks a file used by the operating system |
| Archive | A | Signals that the file changed since the last backup |
| Directory | None, set by the system | Identifies the entry as a folder |
| Not content indexed | I | Excludes the file from the search indexer |
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 system | Basic flags | Extended attributes | Notable special attributes |
|---|---|---|---|
| FAT32 | Yes, one byte | No | None beyond the classic set |
| exFAT | Yes | No | None beyond the classic set |
| NTFS | Yes, 32-bit field | Yes, through streams and EAs | Compressed, encrypted, sparse, reparse point |
| ext4 | Yes, through chattr flags | Yes, xattrs | Immutable, append-only |
| APFS | Yes, BSD flags | Yes, xattrs | Compressed, hidden, immutable |
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 type | Question it answers | Example |
|---|---|---|
| File attribute | How should the system treat this file | Hidden, archive, compressed |
| Permission or ACL | Who may access it and how | Read and write for one group |
| Timestamp | When was it created, changed or accessed | Last modified time |
| Extended attribute | What extra labeled data belongs to it | Quarantine or security label |
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.
| Symptom | Likely cause | Fix |
|---|---|---|
| File cannot be deleted on Linux even as root | Immutable flag set | Remove it with chattr -i |
| Downloaded script shows a security warning | Mark of the web stream present | Unblock it after verifying the source |
| Encryption or labels lost after copying | Target is FAT32 or exFAT | Copy to a file system that supports them |
| Folder appears empty | Files carry the hidden attribute | Enable display of hidden items |
| Backup copies every file each time | Archive bit not cleared by the tool | Use a backup mode that resets it |
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.