Every file and directory in our UNIX/Linux system has following three
permissions :
Non-Directories (Regular Files):
- Read (r): Think of it as the “Read” permission being like reading a book. If you have read permission on a file, you can open and read its contents.
- Write (w): The “Write” permission is like having the ability to write or edit in a notebook. If you have write permission on a file, you can modify its contents.
- Execute (x): The “Execute” permission is like the power to run a program. Without execute permission, even if you can read and write a program, you can’t run it like you can’t run a game without installing it.
Directories:
- Read (r): If you have read permission on a directory, you can see the list of files it contains. It’s like being able to look at the contents of a folder.
- Write (w): Having write permission on a directory is like being the manager of a folder. You can add, remove, or rename files inside the directory.
- Execute (x): The execute permission on a directory allows you to enter into it. Think of it as the ability to enter a room. Without execute permission on a directory, you can’t access its contents, even if you can see the list of files (read permission).
So, in summary:
- Read: View contents of a file or list files in a directory.
- Write: Modify contents of a file or manage files in a directory.
- Execute: Run a program (for files) or access contents of a directory.