How To Check Permissions Of File In Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To check the permissions of a file in Linux, use the ‘ls’ command.
Syntax:
$ ls -l <filename>
Example:
$ ls -l sample.txt
The output will be similar to the following:
-rwxr-xr-x 1 user group 441 Jul 4 10:23 sample.txt
The first letter indicates the file type. The remaining nine characters are the file’s permissions.
There are three groups of three characters each. The first group of three represents the permissions for the file’s owner, the second group is for the file’s group, and the last group is for everyone else. The characters can be either r (read), w (write), or x (execute).
In the example above, the file’s owner has read, write and execute permissions (rwx), the group has read and execute permissions (r-x), and everyone else has read and execute permissions (r-x).