Is it possible when listing a directory to view numerical unix permissions such as 644 rather than the symbolic output -rw-rw-r--
Thanks.
Is it possible when listing a directory to view numerical unix permissions such as 644 rather than the symbolic output -rw-rw-r--
Thanks.
@The MYYN
wow, nice awk! But what about suid, sgid and sticky bit?
You have to extend your filter with s and t, otherwise they will not count and you get the wrong result. To calculate the octal number for this special flags, the procedure is the same but the index is at 4 7 and 10. the possible flags for files with execute bit set are
---s--s--t
amd for files with no execute bit set are---S--S--T
For test:
will result in:
and
will give:
You can use the following command
Also you can use any
filename
ordirectoryname
instead of*
to get a specific result.On Mac, you can use
Closest I can think of (keeping it simple enough) is
stat
, assuming you know which files you're looking for. If you don't,*
can find most of them:It handles sticky, suid and company out of the box:
Use this to display the Unix numerical permission values (octal values) and file name.
Use this to display the Unix numerical permission values (octal values) and the folder's sgid and sticky bit, user name of the owner, group name, total size in bytes and file name.
Add
%y
if you need time of last modification in human-readable format. For more options see stat.Better version using an Alias
Using an alias is a more efficient way to accomplish what you need and it also includes color. The following displays your results organized by group directories first, display in color, print sizes in human readable format (e.g., 1K 234M 2G) edit your
~/.bashrc
and add an alias for your account or globally by editing/etc/profile.d/custom.sh
Typing
cls
displays your new LS command results.Folder Tree
While you are editing your bashrc or custom.sh include the following alias to see a graphical representation where typing
lstree
will display your current folder tree structureIt would display:
no, it can only print numercial uids/guids.
you can just use GNU find.