1ATTR(1) XFS Compatibility API ATTR(1)
2
3
4
6 attr - extended attributes on XFS filesystem objects
7
9 attr [ -LRSq ] -s attrname [ -V attrvalue ] pathname
10
11 attr [ -LRSq ] -g attrname pathname
12
13 attr [ -LRSq ] -r attrname pathname
14
15 attr [ -LRSq ] -l pathname
16
17
19 Extended attributes implement the ability for a user to attach
20 name:value pairs to objects within the XFS filesystem.
21
22 This document describes the attr command, which is mostly compatible
23 with the IRIX command of the same name. It is thus aimed specifically
24 at users of the XFS filesystem - for filesystem independent extended
25 attribute manipulation, consult the getfattr(1) and setfattr(1) docu‐
26 mentation.
27
28 Extended attributes can be used to store meta-information about the
29 file. For example "character-set=kanji" could tell a document browser
30 to use the Kanji character set when displaying that document and
31 "thumbnail=..." could provide a reduced resolution overview of a high
32 resolution graphic image.
33
34 In the XFS filesystem, the names can be up to 256 bytes in length, ter‐
35 minated by the first 0 byte. The intent is that they be printable
36 ASCII (or other character set) names for the attribute. The values can
37 be up to 64KB of arbitrary binary data.
38
39 Attributes can be attached to all types of XFS inodes: regular files,
40 directories, symbolic links, device nodes, etc.
41
42 XFS uses 2 disjoint attribute name spaces associated with every
43 filesystem object. They are the root and user address spaces. The
44 root address space is accessable only to the superuser, and then only
45 by specifying a flag argument to the function call. Other users will
46 not see or be able to modify attributes in the root address space. The
47 user address space is protected by the normal file permissions mecha‐
48 nism, so the owner of the file can decide who is able to see and/or
49 modify the value of attributes on any particular file.
50
52 The attr utility allows the manipulation of extended attributes associ‐
53 ated with filesystem objects from within shell scripts.
54
55 There are four main operations that attr can perform:
56
57 GET The -g attrname option tells attr to search the named object and
58 print (to stdout) the value associated with that attribute name.
59 With the -q flag, stdout will be exactly and only the value of
60 the attribute, suitable for storage directly into a file or pro‐
61 cessing via a piped command.
62
63 LIST The -l option tells attr to list the names of all the attributes
64 that are associated with the object, and the number of bytes in
65 the value of each of those attributes. With the -q flag, stdout
66 will be a simple list of only the attribute names, one per line,
67 suitable for input into a script.
68
69 REMOVE The -r attrname option tells attr to remove an attribute with
70 the given name from the object if the attribute exists. There
71 is no output on sucessful completion.
72
73 SET/CREATE
74 The -s attrname option tells attr to set the named attribute of
75 the object to the value read from stdin. If an attribute with
76 that name already exists, its value will be replaced with this
77 one. If an attribute with that name does not already exist, one
78 will be created with this value. With the -V attrvalue flag,
79 the attribute will be set to have a value of attrvalue and stdin
80 will not be read. With the -q flag, stdout will not be used.
81 Without the -q flag, a message showing the attribute name and
82 the entire value will be printed.
83
84 When the -L option is given and the named object is a symbolic link,
85 operate on the attributes of the object referenced by the symbolic
86 link. Without this option, operate on the attributes of the symbolic
87 link itself.
88
89 When the -R option is given and the process has appropriate privileges,
90 operate in the root attribute namespace rather that the USER attribute
91 namespace.
92
93 The -S option is similar, except it specifies use of the security
94 attribute namespace.
95
96 When the -q option is given attr will try to keep quiet. It will out‐
97 put error messages (to stderr) but will not print status messages (to
98 stdout).
99
101 The standard file interchange/archive programs tar(1), and cpio(1) will
102 not archive or restore extended attributes, while the xfsdump(8) pro‐
103 gram will.
104
106 The list option present in the IRIX version of this command is not sup‐
107 ported. getfattr provides a mechanism to retrieve all of the attribute
108 names.
109
111 getfattr(1), setfattr(1), attr_get(3), attr_set(3), attr_multi(3),
112 attr_remove(3), attr(5), and xfsdump(8).
113
114
115
116Dec 2001 Extended Attributes ATTR(1)