{
    "content": [
        {
            "type": "text",
            "text": "# CHATTR(1) (man)\n\n**Summary:** chattr - change file attributes on a Linux file system\n\n**Synopsis:** chattr [ -RVf ] [ -v version ] [ -p project ] [ mode ] files...\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| -R | — | — |  |\n| -V | — | — |  |\n| -f | — | — |  |\n| -v | — | — | Set the file's version/generation number. |\n| -p | — | — | Set the file's project number. |\n\n## See Also\n\n- lsattr(1)\n- btrfs(5)\n- ext4(5)\n- xfs(5)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (2 lines)\n- **DESCRIPTION** (21 lines)\n- **OPTIONS** (1 lines) — 5 subsections\n  - -R (1 lines)\n  - -V (1 lines)\n  - -f (1 lines)\n  - -v (2 lines)\n  - -p (2 lines)\n- **ATTRIBUTES** (109 lines)\n- **AUTHOR** (3 lines)\n- **BUGS AND LIMITATIONS** (8 lines)\n- **AVAILABILITY** (3 lines)\n- **SEE ALSO** (5 lines)\n\n## Full Content\n\n### NAME\n\nchattr - change file attributes on a Linux file system\n\n### SYNOPSIS\n\nchattr [ -RVf ] [ -v version ] [ -p project ] [ mode ] files...\n\n### DESCRIPTION\n\nchattr changes the file attributes on a Linux file system.\n\nThe format of a symbolic mode is +-=[aAcCdDeFijmPsStTux].\n\nThe operator '+' causes the selected attributes to be added to the existing attributes of the\nfiles; '-' causes them to be removed; and '=' causes them to be the only attributes that  the\nfiles have.\n\nThe letters 'aAcCdDeFijmPsStTux' select the new attributes for the files: append only (a), no\natime updates (A), compressed (c), no copy on write (C), no dump (d),  synchronous  directory\nupdates  (D),  extent format (e), case-insensitive directory lookups (F), immutable (i), data\njournaling (j), don't compress (m), project hierarchy (P), secure deletion  (s),  synchronous\nupdates (S), no tail-merging (t), top of directory hierarchy (T), undeletable (u), and direct\naccess for files (x).\n\nThe following attributes are read-only, and may be listed by lsattr(1) but  not  modified  by\nchattr: encrypted (E), indexed directory (I), inline data (N), and verity (V).\n\nNot  all  flags  are supported or utilized by all file systems; refer to file system-specific\nman pages such as btrfs(5), ext4(5), and xfs(5) for more file system-specific details.\n\n### OPTIONS\n\n#### -R\n\n#### -V\n\n#### -f\n\n#### -v\n\nSet the file's version/generation number.\n\n#### -p\n\nSet the file's project number.\n\n### ATTRIBUTES\n\na      A file with the 'a' attribute set can only be opened in append mode for writing.  Only\nthe  superuser  or  a process possessing the CAPLINUXIMMUTABLE capability can set or\nclear this attribute.\n\nA      When a file with the 'A' attribute set is accessed, its atime record is not  modified.\nThis avoids a certain amount of disk I/O for laptop systems.\n\nc      A  file with the 'c' attribute set is automatically compressed on the disk by the ker‐\nnel.  A read from this file returns uncompressed data.  A  write  to  this  file  com‐\npresses data before storing them on the disk.  Note: please make sure to read the bugs\nand limitations section at the end of this document.  (Note: For  btrfs,  If  the  'c'\nflag  is  set, then the 'C' flag cannot be set. Also conflicts with btrfs mount option\n'nodatasum')\n\nC      A file with the 'C' attribute set will not be subject to copy-on-write updates.   This\nflag is only supported on file systems which perform copy-on-write.  (Note: For btrfs,\nthe 'C' flag should be set on new or empty files.  If it is set on a  file  which  al‐\nready  has  data  blocks, it is undefined when the blocks assigned to the file will be\nfully stable.  If the 'C' flag is set on a directory, it will have no  effect  on  the\ndirectory, but new files created in that directory will have the NoCOW attribute set.\nIf the 'C' flag is set, then the 'c' flag cannot be set.)\n\nd      A file with the 'd' attribute set is not a candidate for backup when the dump(8)  pro‐\ngram is run.\n\nD      When  a directory with the 'D' attribute set is modified, the changes are written syn‐\nchronously to the disk; this is equivalent to the 'dirsync' mount option applied to  a\nsubset of the files.\n\ne      The  'e'  attribute indicates that the file is using extents for mapping the blocks on\ndisk.  It may not be removed using chattr(1).\n\nE      A file, directory, or symlink with the 'E' attribute set is encrypted by the file sys‐\ntem.   This  attribute  may  not be set or cleared using chattr(1), although it can be\ndisplayed by lsattr(1).\n\nF      A directory with the 'F' attribute set indicates that all the path lookups inside that\ndirectory  are made in a case-insensitive fashion.  This attribute can only be changed\nin empty directories on file systems with the casefold feature enabled.\n\ni      A file with the 'i' attribute cannot be modified: it cannot be deleted or renamed,  no\nlink can be created to this file, most of the file's metadata can not be modified, and\nthe file can not be opened in write mode.  Only the superuser or a process  possessing\nthe CAPLINUXIMMUTABLE capability can set or clear this attribute.\n\nI      The  'I' attribute is used by the htree code to indicate that a directory is being in‐\ndexed using hashed trees.  It may not be set or cleared using chattr(1),  although  it\ncan be displayed by lsattr(1).\n\nj      A  file with the 'j' attribute has all of its data written to the ext3 or ext4 journal\nbefore being written to the file itself, if  the  file  system  is  mounted  with  the\n\"data=ordered\"  or  \"data=writeback\"  options and the file system has a journal.  When\nthe file system is mounted with the \"data=journal\" option all  file  data  is  already\njournalled and this attribute has no effect.  Only the superuser or a process possess‐\ning the CAPSYSRESOURCE capability can set or clear this attribute.\n\nm      A file with the 'm' attribute is excluded from compression on file systems  that  sup‐\nport per-file compression.\n\nN      A  file  with  the  'N'  attribute set indicates that the file has data stored inline,\nwithin the inode itself. It may not be set or cleared using chattr(1), although it can\nbe displayed by lsattr(1).\n\nP      A  directory  with  the  'P'  attribute  set will enforce a hierarchical structure for\nproject id's.  This means that files and directories created in the directory will in‐\nherit  the  project  id  of the directory, rename operations are constrained so when a\nfile or directory is moved into another directory, that the project  ids  must  match.\nIn  addition, a hard link to file can only be created when the project id for the file\nand the destination directory match.\n\ns      When a file with the 's' attribute set is deleted, its blocks are zeroed  and  written\nback  to the disk.  Note: please make sure to read the bugs and limitations section at\nthe end of this document.\n\nS      When a file with the 'S' attribute set is  modified,  the  changes  are  written  syn‐\nchronously  to  the  disk;  this is equivalent to the 'sync' mount option applied to a\nsubset of the files.\n\nt      A file with the 't' attribute will not have a partial block fragment at the end of the\nfile  merged  with  other  files  (for those file systems which support tail-merging).\nThis is necessary for applications such as LILO which read the file  system  directly,\nand  which  don't  understand  tail-merged files.  Note: As of this writing, the ext2,\next3, and ext4 file systems do not support tail-merging.\n\nT      A directory with the 'T' attribute will be deemed to be the top of  directory  hierar‐\nchies  for the purposes of the Orlov block allocator.  This is a hint to the block al‐\nlocator used by ext3 and ext4 that the subdirectories under this directory are not re‐\nlated,  and thus should be spread apart for allocation purposes.   For example it is a\nvery good idea to set the 'T' attribute on the /home directory, so that /home/john and\n/home/mary  are  placed into separate block groups.  For directories where this attri‐\nbute is not set, the Orlov block allocator will try to group subdirectories closer to‐\ngether where possible.\n\nu      When  a  file with the 'u' attribute set is deleted, its contents are saved.  This al‐\nlows the user to ask for its undeletion.  Note: please make sure to read the bugs  and\nlimitations section at the end of this document.\n\nx      The  'x'  attribute  can be set on a directory or file.  If the attribute is set on an\nexisting directory, it will be inherited by all files and subdirectories that are sub‐\nsequently created in the directory.  If an existing directory has contained some files\nand subdirectories, modifying the attribute on the parent directory doesn't change the\nattributes on these files and subdirectories.\n\nV      A file with the 'V' attribute set has fs-verity enabled.  It cannot be written to, and\nthe file system will automatically verify all data read  from  it  against  a  crypto‐\ngraphic  hash  that  covers  the entire file's contents, e.g. via a Merkle tree.  This\nmakes it possible to efficiently authenticate the file.  This attribute may not be set\nor cleared using chattr(1), although it can be displayed by lsattr(1).\n\n### AUTHOR\n\nchattr  was  written by Remy Card <Remy.Card@linux.org>.  It is currently being maintained by\nTheodore Ts'o <tytso@alum.mit.edu>.\n\n### BUGS AND LIMITATIONS\n\nThe 'c', 's',  and 'u' attributes are not honored by the ext2, ext3, and ext4 file systems as\nimplemented  in  the current mainline Linux kernels.  Setting 'a' and 'i' attributes will not\naffect the ability to write to already existing file descriptors.\n\nThe 'j' option is only useful for ext3 and ext4 file systems.\n\nThe 'D' option is only useful on Linux kernel 2.5.19 and later.\n\n### AVAILABILITY\n\nchattr is part of the  e2fsprogs  package  and  is  available  from  http://e2fsprogs.source‐\nforge.net.\n\n### SEE ALSO\n\nlsattr(1), btrfs(5), ext4(5), xfs(5).\n\n\n\nE2fsprogs version 1.46.5                    December 2021                                  CHATTR(1)\n\n"
        }
    ],
    "structuredContent": {
        "command": "CHATTR",
        "section": "1",
        "mode": "man",
        "summary": "chattr - change file attributes on a Linux file system",
        "synopsis": "chattr [ -RVf ] [ -v version ] [ -p project ] [ mode ] files...",
        "flags": [
            {
                "flag": "-R",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-V",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-f",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-v",
                "long": null,
                "arg": null,
                "description": "Set the file's version/generation number."
            },
            {
                "flag": "-p",
                "long": null,
                "arg": null,
                "description": "Set the file's project number."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "lsattr",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/lsattr/1/json"
            },
            {
                "name": "btrfs",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/btrfs/5/json"
            },
            {
                "name": "ext4",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/ext4/5/json"
            },
            {
                "name": "xfs",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/xfs/5/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 21,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-R",
                        "lines": 1,
                        "flag": "-R"
                    },
                    {
                        "name": "-V",
                        "lines": 1,
                        "flag": "-V"
                    },
                    {
                        "name": "-f",
                        "lines": 1,
                        "flag": "-f"
                    },
                    {
                        "name": "-v",
                        "lines": 2,
                        "flag": "-v"
                    },
                    {
                        "name": "-p",
                        "lines": 2,
                        "flag": "-p"
                    }
                ]
            },
            {
                "name": "ATTRIBUTES",
                "lines": 109,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "BUGS AND LIMITATIONS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "AVAILABILITY",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}