Pages

Thursday, June 1, 2017

Translate rwx Permissions into Octal Format in Linux

Sometimes you may find it useful to display the access rights of files or directories in octal form instead of rwxor perhaps you want to display both.
Instead of using good old ls -l command, in most modern Linux distributions (if not all) you will find stat, an utility that displays file or filesystem status.
When run without arguments but followed by a given filename, stat will display a good deal of information about the file or directory. If used with the -c option, stat allows you to specify an output format. It is precisely this option that’s of particular interest to us.

To display all files in the current working directory followed by the access rights in octal form, type:
# stat -c '%n %a' *
Sample Output
add_emails.sh 755
anaconda-ks.cfg 600
delete_emails.sh 755
employee-dump.sql 644
index.html 644
latest.tar.gz 644
nrpe-2.15.tar.gz 644
php7 644
playbook.retry 644
Find Linux File Permissions in Octal Format
Find Linux File Permissions in Octal Format
      ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
                                                    ► Read more: http://adf.ly/1n5YJD
      ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

No comments:

Post a Comment