is the
command
Command may refer to:
Computing
* Command (computing), a statement in a computer language
* command (Unix), a Unix command
* COMMAND.COM, the default operating system shell and command-line interpreter for DOS
* Command key, a modifier key on A ...
in
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
that allows a user to set certain
attributes
Attribute may refer to:
* Attribute (philosophy), a characteristic of an object
* Attribute (research), a quality of an object
* Grammatical modifier
In linguistics, a modifier is an optional element in phrase structure or clause structure whic ...
of a file. is the command that displays the attributes of a file.
Most
BSD-like systems, including
macOS
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
, 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 began in the 1970s when University of California, Berkeley received a copy of Research Unix, Unix. Professors and students at the university began adding software to the operating system and releas ...
.
Solaris
Solaris is the Latin word for sun.
It 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
** ''Sol ...
has no commands specifically meant to manipulate them.
and
are used instead.
Other
Unix-like
A Unix-like (sometimes referred to as UN*X, *nix or *NIX) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Uni ...
operating systems, in general, have no analogous commands. The similar-sounding commands (from
HP-UX
HP-UX (from "Hewlett Packard Unix") is a proprietary software, proprietary implementation of the Unix operating system developed by Hewlett Packard Enterprise; current versions support HPE Integrity Servers, based on Intel's Itanium architect ...
) and (from
AIX
Aix or AIX may refer to:
Computing
* AIX, a line of IBM computer operating systems
*Alternate index, for an IBM Virtual Storage Access Method key-sequenced data set
* Athens Internet Exchange, a European Internet exchange point
Places Belg ...
) 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
ext2, or second extended file system, is a file system for the Linux kernel (operating system), kernel. It was initially designed by French software developer Rémy Card as a replacement for the extended file system (ext). Having been designed ...
,
ext3
ext3, or third extended filesystem, is a journaling file system, journaled file system that is commonly used with the Linux kernel. It used to be the default file system for many popular Linux distributions but generally has been supplanted by ...
,
ext4
ext4 (fourth extended filesystem) is a journaling file system for Linux, developed as the successor to ext3.
ext4 was initially a series of backward-compatible extensions to ext3, many of them originally developed by Cluster File Systems for ...
), 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 softwar ...
package.
However, the functionality has since been extended, fully or partially, to many other systems, including
XFS
XFS is a high-performance 64-bit journaling file system created by Silicon Graphics, Inc (SGI) in 1993. It was the default file system in SGI's IRIX operating system starting with its version 5.3. XFS was ported to the Linux kernel in 2001; a ...
,
ReiserFS
ReiserFS is a general-purpose, journaling file system initially designed and implemented by a team at Namesys led by Hans Reiser and licensed under GPLv2. Introduced in version 2.4.1 of the Linux kernel, it was the first journaling file syst ...
,
JFS and
OCFS2
The Oracle Cluster File System (OCFS, in its second version OCFS2) is a shared disk file system developed by Oracle Corporation and released under the GNU General Public License.
The first version of OCFS was developed with the main focus to accom ...
. 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
In computing, a hidden file or hidden directory is a file system object (such as a file or directory) that is excluded from a directory content report unless explicitly requested. The value of hiding files is generally to avoid showing the user ...
*
-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
Apple File System (APFS) is a proprietary file system developed and deployed by Apple Inc. for macOS Sierra (10.12.4) and later, iOS 10.3, tvOS 10.2, watchOS 3.2, and all versions of iPadOS. It aims to fix core problems of HFS+ (also ca ...
,
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. ...
,
SMB,
AFP, and
FAT
In nutrition science, nutrition, biology, and chemistry, fat usually means any ester of fatty acids, or a mixture of such chemical compound, compounds, most commonly those that occur in living beings or in food.
The term often refers specif ...
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:
See also
*
ATTRIB
In computing, ATTRIB is a command in Intel ISIS-II, DOS, IBM OS/2, Microsoft Windows and ReactOS that allows the user to change various characteristics, or " attributes" of a computer file or directory. The command is also available in the EFI ...
– analogous command in MS-DOS, OS/2 and Microsoft Windows
*
chown
, short for change owner, is a shell command for changing the owning user of Unix-based file system files including special files such as directories.
The ownership of a file may only be altered by a super-user (such as via sudo). A reg ...
– change file/directory ownership in a Unix system
*
chmod
is a shell command for changing access permissions and special mode flags of files (including special files such as directories). The name is short for ''change mode'' where ''mode'' refers to the permissions and flags collectively.
The co ...
– 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 ("X is Not Unix") 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, ...
kernel)
{{Unix commands
Unix file system-related software
Linux-only free software