To determine the permission associated with a given file or directory, use the ls -l command to display the contents of the directory:
ls -ltotal 501
-rw-r----- 1 user group 108 Oct 15 19:10 file.1
-rwxr-x--- 1 user group 6452 Oct 15 17:15 program.1
drwxr-xrw- 1 user group 512 Oct 15 19:13 letters
The first character indicates the type of the file
- ordinary filesd directory
l symbolic links
The remaining nine characters represent three sets of three characters: one set for the individual user, one for the user's working group, and one for all other users. Spread out the characters of the display above to explain the groupings:
Type User Group OthersThe permissions given are for reading, writing, and executing. They have different meanings for ordinary files and directories. For an ordinary file, permissions are defined as follows:- rwx r-x --- program.1
d rwx r-x rw- letters
read permission means you may look at the contents of the fileFor a directory, permissions are defined as follows:write permission means you may change the contents of the file or delete it
execute permission means you may execute the file as if it were a
Unix command.
read permission means you may see the names of the files in the directorywrite permission means you may add files to and remove files from the
directory
execute permission means you may change to the directory,
search the directory, and copy files from it.
The characters used to represent these permissions are:
r read permissionw write permission
x execute permission
- permission denied