In FreeBSD and also in Linux, how can I get the numerical chmod value of a file? For example, 644 instead of -rw-r--r--? I need an automatic way for a Bash script.
Get the chmod numerical value for a file
linux;freebsd;chmod
You can get the value directly using a stat output format, e.g. BSD/OS X:stat -f %OLp <file>or in Linuxstat --format '%a' <file>