Quiz Entry - updated: 2026.10.13
What do read, write and execute mean on a directory, as opposed to on a file?
On a directory, r lists the names, w creates, renames and deletes entries, and x lets you enter it and reach the files inside.
| Bit | On a file | On a directory |
|---|---|---|
| r | Open and read the content | List the names inside (ls) |
| w | Change the content | Add, rename or delete entries |
| x | Run it as a program or script | Enter it (cd) and access entries by name, including their details (ls -l) |
A directory is a list of names pointing to files, and the bits apply to that list. Two consequences:
- Deleting a file is a write on its directory, not on the file. A user with
won the directory can delete a file they cannot even read. The sticky bit exists to close exactly this gap. rwithoutxis nearly useless: you see the names but cannot open anything.xwithoutrgives a "blind" directory: you can open a file only if you already know its name.
Go deeper:
ArchWiki: File permissions and attributes — includes a table of what r, w and x allow on directories.