What is the alternative to ls --time-style=full-iso in BSD?
Solution 1:
This comes close:
stat -l -t "%F %T %z" *
but without the sort, columns don't line up and the nanoseconds aren't included. Plus the syntax for file selection is different and other options for ls
aren't available or are different.
This one might be closer:
find . -maxdepth 1 -printf "%M %n %-6u %-6g %6s %TY-%Tm-%Td %TT %TZ %f\n"|sort -k 9
In Mac OSX, gfind
is needed (brew install gfind
) (and note that the granularity will only be in whole seconds):
gfind . -maxdepth 1 -printf "%M %n %-6u %-6g %6s %TY-%Tm-%Td %TT %TZ %f\n"|sort -k 9
Solution 2:
I know this is an old question, but if you're on OS X you can install coreutils to get the GNU version of ls
, which includes the --time-style
option:
brew install coreutils
Note that by default the utilities installed will be prefixed with g
, so ls
becomes gls
.