Chflags
   HOME

TheInfoList



OR:

is the command in Linux that allows a user to set certain attributes of a file. is the command that displays the attributes of a file. Most BSD-like systems, including macOS, have always had an analogous command to set the attributes, but no command specifically meant to display them; specific options to the command are used instead. The chflags command first appeared in
4.4BSD The History of the Berkeley Software Distribution begins in the 1970s. 1BSD (PDP-11) The earliest distributions of Unix from Bell Labs in the 1970s included the source code to the operating system, allowing researchers at universities to modify a ...
.
Solaris Solaris may refer to: Arts and entertainment Literature, television and film * ''Solaris'' (novel), a 1961 science fiction novel by Stanisław Lem ** ''Solaris'' (1968 film), directed by Boris Nirenburg ** ''Solaris'' (1972 film), directed by ...
has no commands specifically meant to manipulate them. and are used instead. Other Unix-like operating systems, in general, have no analogous commands. The similar-sounding commands (from
HP-UX HP-UX (from "Hewlett Packard Unix") is Hewlett Packard Enterprise's proprietary implementation of the Unix operating system, based on Unix System V (initially System III) and first released in 1984. Current versions support HPE Integrity Ser ...
) and (from
AIX Aix or AIX may refer to: Computing * AIX, a line of IBM computer operating systems *An Alternate Index, for a Virtual Storage Access Method Key Sequenced Data Set *Athens Internet Exchange, a European Internet exchange point Places Belgium ...
) exist but have unrelated functions. Among other things, the command is useful to make files immutable so that password files and certain system files cannot be erased during software upgrades.


In Linux systems ( and )


File system support

The command line tools (to manipulate attributes) and (to list attributes) were originally specific to the Second Extended Filesystem family ( ext2, ext3, ext4), and are available as part of the
e2fsprogs e2fsprogs (sometimes called the e2fs programs) is a set of utilities for maintaining the ext2, ext3 and ext4 file systems. Since those file systems are often the default for Linux distributions, it is commonly considered to be essential software. ...
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.


description

The form of the command is: chattr RVf +=AacDdijsTtSu v versionfiles... * -R recursively changes attributes of directories and their contents * -V is to be verbose and print the program version * -f suppresses most error messages


description

The form of the command (gnu 1.41.3): lsattr -RVadv files... * -R recursively lists attributes of directories and their contents * -V displays the program version * -a lists all files in directories, including dotfiles * -d lists directories like other files, rather than listing their contents


Attributes

Some attributes include:


Notes


In BSD-like systems ()


File system support

The command is not specific to particular file systems. UFS on BSD systems, and APFS,
HFS+ HFS Plus or HFS+ (also known as Mac OS Extended or HFS Extended) is a journaling file system developed by Apple Inc. It replaced the Hierarchical File System (HFS) as the primary file system of Apple computers with the 1998 release of Mac OS 8.1 ...
, SMB, AFP, and FAT on macOS support at least some flags.


description

The form of the command is: chflags -L , -P flags file ... * -H If the -R option is specified, symbolic links on the command line are followed. (Symbolic links encountered in the tree traversal are not followed.) * -L If the -R option is specified, all symbolic links are followed. * -P If the -R option is specified, no symbolic links are followed. This is the default. * -R Change the file flags for the file hierarchies rooted in the files instead of just the files themselves.


Displaying

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.


Attributes

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: BSD systems offer additional flags like offline, snapshot, sparse,Different from th
APFS sparse files on macOS
which have no special flags.
and uarchive; see
References Reference is a relationship between objects in which one object designates, or acts as a means by which to connect to or link to, another object. The first object in this relation is said to ''refer to'' the second object. It is called a ''name'' ...
.


See also

* ATTRIB – analogous command in MS-DOS, OS/2 and Microsoft Windows * chown – change file/directory ownership in a Unix system * chmod – change file access control attributes in a Unix system * cacls – change file access control lists in Microsoft Windows NT


Notes


References

* * * * * * (outdated; se
newer version


(flags section in the BSD system source code of the macOS
XNU XNU is the computer operating system (OS) kernel developed at Apple Inc. since December 1996 for use in the Mac OS X (now macOS) operating system and released as free and open-source software as part of the Darwin OS, which in addition to macOS ...
kernel) {{Unix commands Unix file system-related software Linux-only software