Caution: This version of this document is no longer maintained. For the latest documentation, see


Manipulate the attributes of a file (QNX Neutrino)


chattr [+/- attribute]... [filename]...

Runs on:



The attribute you want to remove (-) or set (+).
The name of a file whose attributes you want to display or manipulate.


The chattr utility is a front end to the devctl(DCMD_FSYS_FILE_FLAGS) command (from <sys/dcmd_blk.h>), which gets and sets file attributes (that are outside the scope of the POSIX standard). For example, the DOS/FAT filesystem has the concept of “hidden” or “system” files. Such attributes are typically stored as flags in the on-disk inode of each file.

These attributes are divided into the following classes:

An attribute that corresponds to a concept that may be shared across multiple filesystem formats (even if implemented in a different manner for each one).
An attribute that has meaning only within a specific filesystem.

It's the responsibility of each filesystem module to map generic attributes to and from their private representation.

For example, a hidden file is a generic concept of a filename that may be hidden from normal user browsing (not displayed by ls) but remains available (to open() by an application) if its name is already known. The representation of this concept varies between filesystems:

This mapping functionality allows for application abstraction away from a particular on-disk structure (a program can work unchanged against any file on any filesystem). Many filesystem-specific attributes have no corresponding generic concept, and must be manipulated with knowledge of the underlying filesystem structure; the various <sys/fs_*.h> header files contain relevant bit definitions.

When you invoke chattr with no attributes and a filename (or a list of filenames), it displays the currently set attributes of each file. When you invoke chattr with an attribute (or list of attributes), it applies those modifications to each file.


List the attributes for a file:

# chattr chattr.c
chattr.c: +backup +contiguous +used +modified

Add to and remove from the attributes for a file:

# chattr -archive +system /fs/dos/autoexec.bat
/fs/dos/autoexec.bat: -archive +system

Turn off snapshots for a Power-Safe ( filesystem:

# chattr -snapshot /fs/qnx6
/fs/qnx6: -snapshot

See also:

devb-*, fs-*, fsysinfo,