How to check file permissions in CentOS?
To check the permission of a file, you can use the command ls -l or ls -la.
- List the files in long format, displaying permissions, owner, group, file size, modification time, and other information.
- List all files, including hidden files.
For example, to view the permissions of the file /home/user/file.txt, you can run the following command:
ls -l /home/user/file.txt
The output is similar to:
-rw-r--r-- 1 user group 1024 Apr 1 10:00 file.txt
This includes the file permissions shown as rw-r–r–, where user refers to the owner, group refers to the group the file belongs to, 1024 indicates the file size, Apr 1 10:00 indicates the last modification time, and file.txt is the file name.