.\" Copyright (C) 2001, 2002, 2006, 2007 Silicon Graphics, Inc. .\" All rights reserved. .\" .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual. If not, see .\" . .\" .TH ATTR 1 "Extended Attributes" "Dec 2001" "XFS Compatibility API" .SH NAME attr \- legacy tool to handle extended attributes on filesystem objects .SH SYNOPSIS .nf \fBattr\fP [ \fB\-LRSq\fP ] \fB\-s\fP \fIattrname\fP [ \fB\-V\fP \fIattrvalue\fP ] \c \fIpathname\fP .sp .8v \fBattr\fP [ \fB\-LRSq\fP ] \fB\-g\fP \fIattrname\fP \fIpathname\fP .sp .8v \fBattr\fP [ \fB\-LRSq\fP ] \fB\-r\fP \fIattrname\fP \fIpathname\fP .sp .8v \fBattr\fP [ \fB\-LRSq\fP ] \fB\-l\fP \fIpathname\fP .sp .8v .fi .SH OVERVIEW Extended attributes implement the ability for a user to attach name:value pairs to objects within the filesystem. .PP This document describes the .B attr command, which is mostly compatible with the IRIX command of the same name. It was originally aimed specifically at users of the XFS filesystem, even though it can be used now on any filesystem that supports extended attributes, but for the generic and more portable interface for filesystem independent extended attribute manipulation, consult the .BR getfattr (1) and .BR setfattr (1) documentation. .PP Extended attributes can be used to store meta-information about the file. For example "character-set=kanji" could tell a document browser to use the Kanji character set when displaying that document and "thumbnail=..." could provide a reduced resolution overview of a high resolution graphic image. .PP In supported filesystems, the .I names can 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. The .I values can be up to 64KB of arbitrary binary data. .PP Attributes can be attached to all types of inodes: regular files, directories, symbolic links, device nodes, etc. .PP Extended attributes use several disjoint attribute namespaces associated with every filesystem object: the .B trusted (or .B xfsroot for compatibility with IRIX) namespace, only accessible and visible to the superuser and when requested explicitly with an option, the .B security namespace with the same properties except used for security metadata, and the .B user namespace, which is protected by the normal file permissions mechanism, so the owner of the file can decide who is able to see and/or modify the value of attributes on any particular file. .SH DESCRIPTION The legacy .B attr utility allows the manipulation of extended attributes associated with filesystem objects from within shell scripts. .PP There are four main operations that .B attr can perform: .TP .B GET The .BR \-g " \fIattrname\fP" option tells .B attr to search the named object and print (to \f4stdout\fP) the value associated with that attribute name. With the .B \-q flag, \f4stdout\fP will be exactly and only the value of the attribute, suitable for storage directly into a file or processing via a piped command. .TP .B LIST The .B \-l option tells .B attr to 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 .B \-q flag, \f4stdout\fP will be a simple list of only the attribute names, one per line, suitable for input into a script. .TP .B REMOVE The .BR \-r " \fIattrname\fP" option tells .B attr to remove an attribute with the given name from the object if the attribute exists. There is no output on successful completion. .TP .B SET/CREATE The .BR \-s " \fIattrname\fP" option tells .B attr to set the named attribute of the object to the value read from \f4stdin\fP. 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 .BR \-V " \fIattrvalue\fP" flag, the attribute will be set to have a value of .I attrvalue and \f4stdin\fP will not be read. With the .B \-q flag, \f4stdout\fP will not be used. Without the .B \-q flag, a message showing the attribute name and the entire value will be printed. .PP When the .B \-L option 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. .PP When the .B \-R option is given and the process has appropriate privileges, operate in the .B trusted (or .BR xfsroot ) attribute namespace rather that the .B user attribute namespace. .PP The .B \-S option is similar, except it specifies use of the .B security attribute namespace. .PP When the .B \-q option is given .B attr will try to keep quiet. It will output error messages (to \f4stderr\fP) but will not print status messages (to \f4stdout\fP). .SH "NOTES" The standard file interchange/archive programs .BR tar (1), and .BR cpio (1) will not archive or restore extended attributes. Although GNU tar supports handling extended attributes with its .B \-\-xattrs option. .SH "CAVEATS" The list option present in the IRIX version of this command is not supported. .B getfattr provides a mechanism to retrieve all of the attribute names. .SH AUTHOR Andreas Gruenbacher, .RI < andreas.gruenbacher@gmail.com > and the SGI XFS development team, .RI < linux-xfs@oss.sgi.com >. .P Please send your bug reports or comments to .RI < https://savannah.nongnu.org/bugs/?group=attr > or .RI < acl-devel@nongnu.org >. .SH "SEE ALSO" .BR getfattr (1), .BR setfattr (1), .BR attr_get (3), .BR attr_set (3), .BR attr_multi (3), .BR attr_remove (3), .BR xattr (7), .BR xfsdump (8)