Find the file permission without using ls -l command

https‮ww//:‬w.lautturi.com
Find the file permission without using ls -l command

To find the file permissions of a file without using the ls -l command, you can use the stat command. For example:

stat file.txt

This will display information about the file, including the file permissions. The file permissions will be displayed in the following format:

Access: (0664/-rw-rw-r--)  Uid: ( 1000/  user)   Gid: ( 1000/  user)

The file permissions are shown in the Access field, and are represented by a string of nine characters. The first character represents the file type, and the remaining characters represent the permissions for the owner, group, and others.

In the example above, the file is a regular file (indicated by the - character), and has read and write permissions for the owner and group (indicated by the rw characters), and read-only permissions for others (indicated by the r-- characters).

You can also use the -c option to display the file permissions in a more human-readable format. For example:

stat -c "%A %a %n" file.txt

This will display the file permissions in the following format:

-rw-rw-r-- 664 file.txt

For more information on the stat command and the options it supports, you can refer to the command's man page or online documentation.

Created Time:2017-10-28 20:40:31  Author:lautturi