getfattr
extended attribute retrieval tool
TLDR
Retrieve all extended attributes of a file in detailed format
SYNOPSIS
getfattr [options] file...
DESCRIPTION
getfattr retrieves extended attributes (xattrs) from files and directories. Extended attributes are name:value pairs associated with files, stored separately from the normal file data.
Common namespaces include user. for user-defined attributes, security. for security labels (like SELinux), system. for system attributes (like ACLs), and trusted. for trusted attributes (root only).
Extended attributes are useful for storing metadata like checksums, tags, origins, or application-specific data without modifying the file contents.
PARAMETERS
-d, --dump
Dump all extended attribute names and values-n, --name NAME
Get the value of a specific attribute-m, --match PATTERN
Only show attributes matching regex pattern-e, --encoding ENC
Encode values as text, hex, or base64-R, --recursive
List attributes recursively-L, --logical
Follow symbolic links (default)-P, --physical
Do not follow symbolic links--only-values
Print only attribute values, not names
CAVEATS
Extended attribute support depends on the filesystem (ext4, XFS, Btrfs support them; FAT does not). The user namespace is the only one writable by non-root users. Attributes may not be preserved when copying files without special options.
HISTORY
Extended attributes became widely available in Linux with kernel 2.6 in the early 2000s. The getfattr and setfattr commands are part of the attr package, providing command-line access to the xattr system calls.
