xattr(1)SourceForge.net Logoxattr(1)



xattr - Manipulate the extended attributes of files.


xattr [-sl] <path...>
xattr -p [-sl] name <path...>
xattr -d [-sl] name <path...>
xattr -w [-slRC] name value <path...>


With the xattr command, the extended attributes of one or more files may be listed, written (set), printed (displayed), or deleted.

Extended attributes allow the arbitrary association of name:data pairs with file system objects (file, directories, symbolic links, et cetera). The name of an extended attribute may be any null-terminated UTF-8 string. The data associated with it may be either textual or binary.

This implimentation of the xattr command is designed to be backwards-compatible with the python script that shipped as /usr/bin/xattr with Macintosh OS 10.5.0 (Leopard). The display format has been changed slightly for use in shell scripts.

By default, xattr lists the extended attributes associate with the file object at the specified path. Alternate behavior is triggered by the use of a command flag.


  • Feedback regarding bugs, missing functionality, or documentation issues.
  • Code verification or correction by more experienced developers.
  • All inquiries welcome.

    defaultList the extended attributes of the given file objects.
    -pDisplay (print) the value of a given extended attribute for each file object.
    -dDelete an existing extended attribute from all of the file objects.
    -wSet (write) a given extended attribute of the file objects to a given value.

    -vDisplay version information.
    -hDisplay help.


    -sDo not follow symbolic links.
    -lDisplay results in extended format.
    -RExpect to edit existing extended attributes; fail rather than create a new one.
    -CExpect to create new extended attributes; fail rather than edit an existing one.


    /usr/local/bin/xattr the xattr executable.
    /usr/share/man/xattr.1 this page.


    svn co https://xattr.svn.sourceforge.net/svnroot/xattr xattr access via subversion.
    http://sourceforge.net/projects/xattr the xattr package at Sourceforge (depreciated method).


    getxattr(2), setxattr(2), listxattr(2), removexattr(2).


    None currently known. However, this implimentation of the xattr command was written by a computer hobbyist; the source code has not, as of v0.3, been reviewed by an experienced C programmer.


    MIT licensed open-source software. (C) Matt Lye 2008. (see COPYING.TXT in repository or package.)


    Bob Ippolito and Marquis Logan deserve much credit for their versions of xattr, written for python (as seen here) and with CoreFoundation (over here), respectively. I first encountered extended attributes in the arstechnica article I have cited.