Linux CLI view octal file permissions

Your regular ls -l output on a Linux machine will show a bunch of information including the file permissions displayed as following:

-rwxr-xr-x. 1 root root 4096 Jun 11 10:44 example.txt

  • r = readable (=4);
  • w = writable (=2);
  • x = executable (=1);

So based on the example above:

  • readable (r) and writable (w) and executable (x) by the owner (root);
  • readable (r) not writable (-) but executable (x) by the group (root);
  • readable (r) not writable (-) but executable (x) by others.

In case you need the file permissions in a octal format, use the following command stat -c "%a %n" *

This will simply output: 755 example.txt

 

Be the first to comment

Leave a Reply

Your email address will not be published.


*


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