Understanding File Modes (Permissions)

The following section uses the word file to mean both files and directories, and the word plain, or regular, file to refer to a file (not a directory).

In the previous section, you saw that ls could tell you permission information about files:

ls -ldg security.html
-rwxr-xr--   1 blackie  users 12383 Mar 15 10:27 security.html

The following file modes (permission information) are given in the first 10 characters of each output line from a long listing (see Figure 14.1):

  • 1 character: file type

  • 3 characters: permissions for the user who is the file owner

  • 3 characters: permissions if not owner but in same group

  • 3 characters: permissions if not owner nor in same group

Figure 14.1. File mode is one file type bit and ...

Get Practical UNIX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.