-
Notifications
You must be signed in to change notification settings - Fork 0
/
xattr.man
110 lines (85 loc) · 5.29 KB
/
xattr.man
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
XATTR(1) BSD General Commands Manual XATTR(1)
NNAAMMEE
xxaattttrr -- display and manipulate extended attributes
SSYYNNOOPPSSIISS
xxaattttrr [--llrrssvvxx] _f_i_l_e _._._.
xxaattttrr --pp [--llrrssvvxx] _a_t_t_r___n_a_m_e _f_i_l_e _._._.
xxaattttrr --ww [--rrssxx] _a_t_t_r___n_a_m_e _a_t_t_r___v_a_l_u_e _f_i_l_e _._._.
xxaattttrr --dd [--rrssvv] _a_t_t_r___n_a_m_e _f_i_l_e _._._.
xxaattttrr --cc [--rrssvv] _f_i_l_e _._._.
xxaattttrr --hh | ----hheellpp
DDEESSCCRRIIPPTTIIOONN
The xxaattttrr command can be used to display, modify or remove the extended
attributes of one or more files, including directories and symbolic
links. Extended attributes are arbitrary metadata stored with a file,
but separate from the filesystem attributes (such as modification time or
file size). The metadata is often a null-terminated UTF-8 string, but
can also be arbitrary binary data.
One or more files may be specified on the command line. For the first
two forms of the command, when there are more than one file, the file
name is displayed along with the actual results. When only one file is
specified, the display of the file name is usually suppressed (unless the
--vv option described below, is also specified).
In the first form of the command (without any other mode option speci-
fied), the names of all extended attributes are listed. Attribute names
can also be displayed using ``ls -l@''.
In the second form, using the --pp option (``print''), the value associated
with the given attribute name is displayed. Attribute values are usually
displayed as strings. However, if nils are detected in the data, the
value is displayed in a hexadecimal representation.
The third form, with the --ww option (``write''), causes the given
attribute name to be assigned the given value.
The fourth form, with the --dd option (``delete''), causes the given
attribute name (and associated value), to be removed.
In the fifth form, with the --cc option (``clear''), causes all attributes
(including their associated values), to be removed.
Finally, the last form, with either the --hh or ----hheellpp option, displays a
short help message and exits immediately.
OOPPTTIIOONNSS
--ll By default, the first two command forms either displays just the
attribute names or values, respectively. The --ll option causes both
the attribute names and corresponding values to be displayed. For
hexadecimal display of values, the output is preceeded with the hexa-
decimal offset values and followed by ASCII display, enclosed by
``|''.
--rr If a file argument is a directory, act as if the entire contents of
the directory recursively were also specified (so that every file in
the directory tree is acted upon).
--ss If a file argument is a symbolic link, act on the symbolic link
itself, rather than the file that the symbolic link points at.
--vv Force the file name to be displayed, even for a single file.
--xx Force the attribute value to be displayed in the hexadecimal repre-
sentation.
The --ww option normally assumes the input attribute value is a string.
Specifying the --xx option causes xxaattttrr to expect the input in hexadec-
imal (whitespace is ignored). The xxd(1) command can be used to cre-
ate hexadecimal representations from exising binary data, to pass to
xxaattttrr.
EEXXIITT SSTTAATTUUSS
The xxaattttrr command exits with zero status on success. On error, non-zero
is returned, and an error message is printed to the standard error. For
system call errors, both the error code and error string are printed (see
getxattr(2), listxattr(2), removexattr(2) and setxattr(2) for a complete
list of possible error codes).
Some attribute data may have a fixed length that is enforced by the sys-
tem. For example,
% xattr -w com.apple.FinderInfo 0 foo
xattr: [Errno 34] Result too large: 'foo'
The com.apple.FinderInfo attribute must be 32 bytes in length.
EEXXAAMMPPLLEESS
This example copies the com.apple.FinderInfo attribute from the /usr
directory to the MyDir directory:
% xattr -px com.apple.FinderInfo /usr
00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
% xattr -l MyDir
% xattr -wx com.apple.FinderInfo \
"`xattr -px com.apple.FinderInfo /usr`" MyDir
% xattr -l MyDir
com.apple.FinderInfo:
00000000 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 |........@.......|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000020
SSEEEE AALLSSOO
ls(1), xxd(1), getxattr(2), listxattr(2), removexattr(2), setxattr(2)
BSD Nov 29, 2010 BSD