lsattr Command
The lsattr command is a Unix/Linux command used to list the attributes of files or directories on a file system that supports extended attributes. Extended attributes are additional metadata associated with a file or directory beyond the traditional metadata, like permissions, ownership, and modification time.
lsattr [options] [files/directories]
-a
: Lists all files and directories, including those whose names start with a dot (hidden files).-d
: If the argument is a directory, list the attributes of the directory itself rather than its contents.-R
: Recursively lists the attributes of directories and their contents.
chattr command in Linux with examples
The chattr command in Linux is a file system command which is used for changing the attributes of a file in a directory. The primary use of this command is to make several files unable to be altered by users other than the superuser. As we know, Linux is a multi-user operating system. There is a chance that a user can delete a file that is of great concern to another user, says the administrator. To avoid such kinds of scenarios, Linux provides ‘chattr‘. In short, ‘chattr’ can make a file immutable, undeletable, only dependable and many more!