Original author(s) | Remy Card |
---|---|
Operating system | Linux |
Platform | Cross-platform |
Type | Command |
Operating system | BSD-like systems, including macOS |
---|---|
Platform | Cross-platform |
Type | Command |
chattr is the command in Linux that allows a user to set certain attributes of a file. lsattr is the command that displays the attributes of a file.
Most BSD-like systems, including macOS, have always had an analogous chflags command to set the attributes, but no command specifically meant to display them; specific options to the ls command are used instead. The chflags command first appeared in 4.4BSD.
Solaris has no commands specifically meant to manipulate them. chmod[1] and ls[2] are used instead.
Other Unix-like operating systems, in general, have no analogous commands. The similar-sounding commands chatr (from HP-UX) and lsattr (from AIX) exist but have unrelated functions.
Among other things, the chattr command is useful to make files immutable so that password files and certain system files cannot be erased during software upgrades.[3]