File and Directory Permissions

Checking Permissions with ls

The ls command is used to list files and directories. When combined with the -l option, it provides detailed information about files and directories, including their permissions.

ls -l
  • -l: This option provides a long listing format, showing additional information about files and directories.

The output will look something like this:

-rw-r--r-- 1 user group 4096 Oct 30 10:00 example.txt
  1. rw-r--r--: This represents the file permissions. The first three characters (rw-) indicate read and write permissions for the user, the next three (r--) indicate read-only permissions for the group, and the last three (r--) indicate read-only permissions for others.
  2. 1: This indicates the number of hard links to the file.
  3. user: This is the owner of the file.
  4. group: This is the group associated with the file.
  5. 4096: This is the file size in bytes.
  6. Oct 30 10:00: This is the last modification time of the file.
  7. example.txt: This is the name of the file.

Leave a Reply

Your email address will not be published. Required fields are marked *