Understanding File Permission

To check file permissions, use

ls -l filename
Output
-rwxr--r--. 1 alamgir alamgir 13 Nov 24 19:40 a.txt


alt text

1. File Type

Symbol File Type Short Meaning Example
d Directory Stores other files /home
- Regular file Normal file (text, image, etc.) data.txt
l Symbolic link Points to another file link -> file.txt
s Socket Process communication Used by web servers
p Pipe Data stream between processes ls grep txt
b Block file Hardware device (storage) /dev/sda
c Character file Hardware device (keyboard, etc.) /dev/tty

2. Permissions

Permissions show how different users can access and use a file.

Permission Field Explanation
Owner (User) - Applies if current account is file owner.
- Others’ permissions do not apply.
Group - Applies if not owner but member of group.
- Owner and others’ permissions do not apply
Other - Applies if neither owner nor in group.
- Owner and group permissions do not apply.
Permission Type File Effect Directory Effect
read (r) Read or copy file contents List files (non-detailed without x, detailed with x)
write (w) Modify or overwrite file contents Add or remove files (requires x)
execute (x) Run file as a process (needs r for scripts) Enter/change to directory (requires x on parent directories)
  • Files need r/w/x for content access or execution.
  • Directories need x to access contents, w to modify contents, r to list contents.


3.Hard Link Count : This value shows how many hard links point to this file.

  1. Owner : When a file is created, ownership is automatically assigned to the user who created it.

  2. Group Owner : Shows which group owns this file.

  3. File Size : Size of the file /directory in bytes.

  4. Timestamp : This indicates when the file contents were last changed.

  5. Directory / File Name: Name of the directory or file.


alt text

Part Meaning
- Indicates a regular file (not a directory or special file).
rwx Owner (alamgir) permissions:
- r → read
- w → write
- x → execute
These permissions apply only to the file owner.
r-- Group (alamgir) permissions:
- r → read only
No write or execute permission for group members.
r-- Others (everyone else) permissions:
- r → read only
No write or execute permission.
. SELinux security context is enabled
alamgir User owner of the file.
alamgir Group owner of the file.
13 File size in bytes.
Nov 24 19:40 Last modification date and time.
a.txt File name.