{
    "mode": "man",
    "parameter": "ATTR",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/ATTR/1/json",
    "generated": "2026-06-03T14:21:16Z",
    "synopsis": "attr [ -LRSq ] -s attrname [ -V attrvalue ] pathname\nattr [ -LRSq ] -g attrname pathname\nattr [ -LRSq ] -r attrname pathname\nattr [ -LRSq ] -l pathname",
    "sections": {
        "NAME": {
            "content": "attr - extended attributes on filesystem objects\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "attr [ -LRSq ] -s attrname [ -V attrvalue ] pathname\n\nattr [ -LRSq ] -g attrname pathname\n\nattr [ -LRSq ] -r attrname pathname\n\nattr [ -LRSq ] -l pathname\n\n",
            "subsections": []
        },
        "OVERVIEW": {
            "content": "Extended  attributes  implement  the ability for a user to attach name:value pairs to objects\nwithin the filesystem.\n\nThis document describes the attr command, which is mostly compatible with the IRIX command of\nthe  same  name.   It  was originally aimed specifically at users of the XFS filesystem, even\nthough it can be used now on any filesystem that supports extended attributes,  but  for  the\ngeneric  and  more portable interface for filesystem independent extended attribute manipula‐\ntion, consult the getfattr(1) and setfattr(1) documentation.\n\nExtended attributes can be used to store meta-information about the file.  For example \"char‐\nacter-set=kanji\" could tell a document browser to use the Kanji character set when displaying\nthat document and \"thumbnail=...\" could provide a reduced resolution overview of a high reso‐\nlution graphic image.\n\nIn supported filesystems, the names can be up to 256 bytes in length, terminated by the first\n0 byte.  The intent is that they be printable ASCII (or other character set)  names  for  the\nattribute.  The values can be up to 64KB of arbitrary binary data.\n\nAttributes  can  be  attached  to  all  types of inodes: regular files, directories, symbolic\nlinks, device nodes, etc.\n\nExtended attributes use 2 disjoint attribute name spaces associated with every filesystem ob‐\nject.   They are the root and user address spaces.  The root address space is accessible only\nto the superuser, and then only by specifying a flag argument to the  function  call.   Other\nusers  will  not see or be able to modify attributes in the root address space.  The user ad‐\ndress space is protected by the normal file permissions mechanism, so the owner of  the  file\ncan decide who is able to see and/or modify the value of attributes on any particular file.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The  attr  utility  allows the manipulation of extended attributes associated with filesystem\nobjects from within shell scripts.\n\nThere are four main operations that attr can perform:\n\nGET    The -g attrname option tells attr to search the named object and print (to ssttddoouutt) the\nvalue  associated  with that attribute name.  With the -q flag, ssttddoouutt will be exactly\nand only the value of the attribute, suitable for storage directly into a file or pro‐\ncessing via a piped command.\n\nLIST   The  -l  option tells attr to list the names of all the attributes that are associated\nwith the object, and the number of bytes in the value of  each  of  those  attributes.\nWith  the  -q  flag, ssttddoouutt will be a simple list of only the attribute names, one per\nline, suitable for input into a script.\n\nREMOVE The -r attrname option tells attr to remove an attribute with the given name from  the\nobject if the attribute exists.  There is no output on successful completion.\n\nSET/CREATE\nThe  -s  attrname  option  tells  attr to set the named attribute of the object to the\nvalue read from ssttddiinn.  If an attribute with that name already exists, its value  will\nbe replaced with this one.  If an attribute with that name does not already exist, one\nwill be created with this value.  With the -V attrvalue flag, the  attribute  will  be\nset to have a value of attrvalue and ssttddiinn will not be read.  With the -q flag, ssttddoouutt\nwill not be used.  Without the -q flag, a message showing the attribute name  and  the\nentire value will be printed.\n\nWhen  the  -L  option  is  given  and the named object is a symbolic link, operate on the at‐\ntributes of the object referenced by the symbolic link.  Without this option, operate on  the\nattributes of the symbolic link itself.\n\nWhen  the  -R option is given and the process has appropriate privileges, operate in the root\nattribute namespace rather that the USER attribute namespace.\n\nThe -S option is similar, except it specifies use of the security attribute namespace.\n\nWhen the -q option is given attr will try to keep quiet.  It will output error  messages  (to\nssttddeerrrr) but will not print status messages (to ssttddoouutt).\n",
            "subsections": []
        },
        "NOTES": {
            "content": "The  standard  file  interchange/archive programs tar(1), and cpio(1) will not archive or re‐\nstore extended attributes, while the xfsdump(8) program will.\n",
            "subsections": []
        },
        "CAVEATS": {
            "content": "The list option present in the IRIX version of this command is not supported.  getfattr  pro‐\nvides a mechanism to retrieve all of the attribute names.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Andreas  Gruenbacher,  <andreas.gruenbacher@gmail.com>  and  the  SGI  XFS  development team,\n<linux-xfs@oss.sgi.com>.\n\nPlease send your bug reports or comments to <https://savannah.nongnu.org/bugs/?group=attr> or\n<acl-devel@nongnu.org>.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "getfattr(1),  setfattr(1),  attrget(3), attrset(3), attrmulti(3), attrremove(3), attr(5),\nxfsdump(8)\n\n\n\nDec 2001                                 Extended Attributes                                 ATTR(1)",
            "subsections": []
        }
    },
    "summary": "attr - extended attributes on filesystem objects",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "getfattr",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/getfattr/1/json"
        },
        {
            "name": "setfattr",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/setfattr/1/json"
        },
        {
            "name": "attrget",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/attrget/3/json"
        },
        {
            "name": "attrset",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/attrset/3/json"
        },
        {
            "name": "attrmulti",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/attrmulti/3/json"
        },
        {
            "name": "attrremove",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/attrremove/3/json"
        },
        {
            "name": "attr",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/attr/5/json"
        },
        {
            "name": "xfsdump",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/xfsdump/8/json"
        }
    ]
}