The command line tools chattr (to manipulate attributes) and lsattr (to list attributes) were originally specific to the Second Extended Filesystem family (ext2, ext3, ext4), and are available as part of the e2fsprogs package.
However, the functionality has since been extended, fully or partially, to many other systems, including XFS, ReiserFS, JFS and OCFS2. The btrfs file system includes the attribute functionality, including the C flag, which turns off the built-in copy-on-write (CoW) feature of btrfs due to slower performance associated with CoW.
The form of the chattr command is:
The form of the lsattr command (gnu 1.41.3):
Some attributes include:
The chflags command is not specific to particular file systems. UFS on BSD systems, and APFS, HFS+, SMB, AFP, and FAT on macOS support at least some flags.
The form of the chflags command is:
BSD-like systems, in general, have no default user-level command specifically meant to display the flags of a file. The ls command will do with either the -lo, or the -lO, depending on the system, flags passed.
All traditional attributes can be set or cleared by the super-user; some can also be set or cleared by the owner of the file. Some attributes include:
chmod(1) – illumos and OpenSolaris User Commands Reference Manual from latest Sun based OpenSolaris http://schillix.org/opensolarisman/man1/chmod.1.html ↩
ls(1) – illumos and OpenSolaris User Commands Reference Manual from latest Sun based OpenSolaris http://schillix.org/opensolarisman/man1/ls.1.html ↩
chflags(1) – OpenBSD General Commands Manual https://man.openbsd.org/chflags.1 ↩
Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear these attributes. ↩
These attributes are not honored by the ext2 and ext3 filesystems as implemented in the current mainline Linux kernels. /wiki/Ext2 ↩
These attributes only make sense for Copy-on-Write file-systems such as btrfs. /wiki/Btrfs ↩
Only the superuser or a process possessing the CAP_SYS_RESOURCE capability can set or clear this attribute. ↩
This attribute is not honored by the ext4 filesystem as implemented in the current mainline Linux kernels as reported in Bug #17872. /wiki/Ext4 ↩