mode_t | | 16 bit |
|
| bit | octal | decimal | c++ name | Description |
| 0 | 1 | 1 | S_IXOTH | others have execute permission |
| 1 | 2 | 2 | S_IWOTH | others have write permisson |
| 2 | 4 | 4 | S_IROTH | others have read permission |
| 0+1+2 | 7 | 7 | S_IRWXO | others have read, write and execute permission |
| 3 | 10 | 8 | S_IXGRP | group has execute permission |
| 4 | 20 | 16 | S_IWGRP | group has write permission |
| 5 | 40 | 32 | S_IRGRP | group has read permission |
| 3+4+5 | 70 | 56 | S_IRWXG | group has read, write and execute permission |
| 6 | 100 | 64 | S_IXUSR | user has execute permission |
| 7 | 200 | 128 | S_IWUSR | user has write permission |
| 8 | 400 | 256 | S_IRUSR | user has read permission |
| 6+7+8 | 700 | 448 | S_IRWXU | user has read, write and execute permission |
| 9 | 1000 | 512 | S_ISVTX | Save swapped text after use (sticky) |
| 10 | 2000 | 1024 | S_ISGID | Set group ID on execution |
| 11 | 4000 | 2048 | S_ISUID | Set user ID on execution |
| 12 | 10000 | 4096 | S_IFIFO | FIFO |
| 13 | 20000 | 8192 | S_IFCHR | Character device |
| 14 | 40000 | 16384 | S_IFDIR | Directory |
| 13+14 | 60000 | 24576 | S_IFBLK | Block device |
| 15 | 100000 | 32768 | S_IFREG | Regular file |
| 13+15 | 120000 | 40960 | S_IFLNK | Symbolic link |
| 14+15 | 140000 | 49152 | S_IFSOCK | Socket |
| 12+13+14+15 | 170000 | 61440 | S_IFMT | These bits determine file type |