I can use stat
to create an ls output that shows both formats of permission information which can be handy:
stat --printf="%A\t%a\t%h\t%U\t%G\t%s\t%.19y\t%n\n" . .*
drwxr-xr-x 755 4 boss boss 4096 2021-10-29 22:49:12 .
drwxr-xr-x 755 4 boss boss 4096 2021-10-29 22:49:12 .
drwxr-xr-x 755 36 boss boss 4096 2021-11-01 11:30:24 ..
-rw-r--r-- 644 1 boss boss 97708 2021-11-01 11:30:16 .custom
-rw-r--r-- 644 1 boss boss 4013 2021-10-11 22:04:04 .custom-dk
However, the spacing between columns uses \t
which is fine, but quite 'gappy'. This made me curious, is there a generic way to post-process any outputs like this such that the columns will be at the lowest common denominator of one-space gaps, i.e. is there a generic way to adjust the above to something like the below using awk
or sed
or similar (I'm also right-justifying just the number columns as an 'ideal' output, if that's possible)?
drwxr-xr-x 755 4 boss boss 4096 2021-10-29 22:49:12 .
drwxr-xr-x 755 4 boss boss 4096 2021-10-29 22:49:12 .
drwxr-xr-x 755 36 boss boss 4096 2021-11-01 11:30:24 ..
-rw-r--r-- 644 1 boss boss 97708 2021-11-01 11:30:16 .custom
-rw-r--r-- 644 1 boss boss 4013 2021-10-11 22:04:04 .custom-dk
column -t
reduces the space a bit, but not as much as your desired output