Skip to content

Instantly share code, notes, and snippets.

@kat47
Created March 15, 2021 20:52
Show Gist options
  • Save kat47/65747a378387bd759ef2a0afcf2f9592 to your computer and use it in GitHub Desktop.
Save kat47/65747a378387bd759ef2a0afcf2f9592 to your computer and use it in GitHub Desktop.
Misc Linux Commands

Get file permissions Linux

In octal

stat -c "%a %n" /path/to/folder/or/file

$ stat -c "%a %n" nginx.conf
644 nginx.conf

For the parent directories as well

namei -om /path/to/folder/or/file

$ namei -om /etc/nginx/nginx.conf
f: /etc/nginx/nginx.conf
 drwxr-xr-x root root /
 drwxr-xr-x root root etc
 drwxr-xr-x root root nginx
 -rw-r--r-- root root nginx.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment