Linux command
getfattr 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Example
getfattr -d [path/to/file]
Example
getfattr -n user.[attribute_name] [path/to/file]
说明
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.
参数
- -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
FAQ
What is the getfattr command used for?
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.
How do I run a basic getfattr example?
Run `getfattr -d [path/to/file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -d, --dump do in getfattr?
Dump all extended attribute names and values