When we do: ls -l
we get something like:
-rw-r--r-- 1 jm jm 0 05-23 11:41 test
I’m aware that in numeric format it’s 644.
Is there a way to read it somehow to get:
644 1 jm jm 0 05-23 11:41 test
Or something similar?
Please read my very elaborate tutorial on the subject…
5 Likes
I’ll definitely do but I’m curious right now
Is there an answer to my question or just explanation of the subject?
I know that read is 4 write is 2 and execute is 1, and we can add them to get desired permission.
stat
filename
or example (use %a read man):
stat -c '%n %U:%G %a = %A %F' $HOME/*
echo -e "$(stat -c '%n %U:%G \033[32m%a\033[0m = %A %F' $HOME/*)"
6 Likes
Exactly what I needed. Thank you!!!
Cool.
Just an alternative… If --printf
rather -c
is used, the echo -e
and command substitution can be eliminated. A ‘\n’ needs to be added though.
2 Likes
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.