How to view permissions in numeric way in Linux ?

Here we will check a small trick to view the permissions in numeric way in Linux.

For this, we can use the stat command with some options, or do some calculations and implement using chmod/find command.

The most easiest and best way to check the numeric permissions of a file/directory in numeric way is to use stat command.

[root@nglinux ~]# stat -c "%a %n" test/ test/file1
755 test/
644 test/file1
[root@nglinux ~]# 

The above command can be best used in scripts to identify the permissions of a particular file and change it when required.

Leave a Reply

Your email address will not be published.