Get permission of chmod as numerical value on Linux

chmod command is used to change the permissions of files or directories. In this tutorial, I will get permission of chmod as numerical value on Linux.

For example, Check Linux file and folder permissions with ls command as below

[vagrant@app1 ~]$ ls -l /home/vagrant/*
-rw-rw-r--. 1 vagrant vagrant   64 Feb 26 15:30 /home/vagrant/a
-rwxrwxr-x. 1 vagrant vagrant  241 Dec 10 15:31 /home/vagrant/
-rw-rw-r--. 1 vagrant vagrant 3327 Nov 13 12:07 /home/vagrant/id_rsa
-rw-rw-r--. 1 vagrant vagrant  439 Feb 26 15:30 /home/vagrant/

Using stat command as below

[vagrant@app1 ~]$ stat --format='%a %U:%G %n' /home/vagrant/*

The result as below

664 vagrant:vagrant /home/vagrant/a
775 vagrant:vagrant /home/vagrant/
664 vagrant:vagrant /home/vagrant/id_rsa
664 vagrant:vagrant /home/vagrant/

You make it 🙂


About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

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

Comment moderation is enabled. Your comment may take some time to appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.