MAN page from OpenSuSE attr-2.4.48-70.1.x86_64.rpm
Section: XFS Compatibility API (1)
Updated: Extended AttributesIndex
attr - extended attributes on XFS filesystem objects
attr [ -LRSq ] -s attrname [ -V attrvalue ] pathnameattr [ -LRSq ] -g attrname pathnameattr [ -LRSq ] -r attrname pathnameattr [ -LRSq ] -l pathname
Extended attributes implement the ability for a user to attachname:value pairs to objects within the XFS filesystem.
This document describes theattrcommand, which is mostly compatible with the IRIX command of the same name.It is thus aimed specifically at users of the XFS filesystem - forfilesystem independent extended attribute manipulation, consult thegetfattr(1)and setfattr(1)documentation.
Extended attributes can be used to store meta-information about the file.For example "character-set=kanji" could tell a document browser touse the Kanji character set when displaying that documentand "thumbnail=..." could provide a reduced resolution overview of ahigh resolution graphic image.
In the XFS filesystem, thenamescan be up to 256 bytes in length, terminated by the first 0 byte.The intent is that they be printable ASCII (or other character set)names for the attribute.Thevaluescan be up to 64KB of arbitrary binary data.
Attributes can be attached to all types of XFS inodes:regular files, directories, symbolic links, device nodes, etc.
XFS uses 2 disjoint attribute name spaces associated with everyfilesystem object.They are therootanduseraddress spaces.Therootaddress space is accessible only to the superuser,and then only by specifying a flag argument to the function call.Other users will not see or be able to modify attributes in therootaddress space.Theuseraddress space is protected by the normal file permissions mechanism,so the owner of the file can decide who is able to see and/or modifythe value of attributes on any particular file.
utility allows the manipulation of extended attributes associated withfilesystem objects from within shell scripts.
There are four main operations thatattrcan perform:
- The-g attrnameoption tellsattrto search the named object and print (to stdout) the valueassociated with that attribute name.With the-qflag, stdout will be exactly and only the value of the attribute,suitable for storage directly into a file or processing via a piped command.
- The-loption tellsattrto list the names of all the attributes that are associated with the object,and the number of bytes in the value of each of those attributes.With the-qflag, stdout will be a simple list of only the attribute names,one per line, suitable for input into a script.
- The-r attrnameoption tellsattrto remove an attribute with the given name from the object if theattribute exists.There is no output on successful completion.
- The-s attrnameoption tellsattrto set the named attribute of the object to the value read from stdin.If an attribute with that name already exists,its value will be replaced with this one.If an attribute with that name does not already exist,one will be created with this value.With the-V attrvalueflag, the attribute will be set to have a value ofattrvalueand stdin will not be read.With the-qflag, stdout will not be used.Without the-qflag, a message showing the attribute name and the entire valuewill be printed.
When the-Loption is given and the named object is a symbolic link,operate on the attributes of the object referenced by the symbolic link.Without this option, operate on the attributes of the symbolic link itself.
When the-Roption is given and the process has appropriate privileges,operate in therootattribute namespace rather that theUSERattribute namespace.
The-Soption is similar, except it specifies use of thesecurityattribute namespace.
When the-qoption is givenattrwill try to keep quiet.It will output error messages (to stderr)but will not print status messages (to stdout).
The standard file interchange/archive programstar
(1)will not archive or restore extended attributes,while thexfsdump
The list option present in the IRIX version of this command is not supported.getfattr
provides a mechanism to retrieve all of the attribute names.
- SEE ALSO
This document was created byman2html,using the manual pages.