we would avoid doing this. the output ofAnother way to do this would be:
ls -l |awk '{if (NF == 9) {print $9, $5, $6, $7}}'
ls is not stable or parseable, it is for humans to read.Sure, I myself would go with stat(1) as covacat suggested, but just as a quick, dirty, but working solution.we would avoid doing this. the output oflsis not stable or parseable, it is for humans to read.
-l output can potentially be different in different systems (implementations)? ls is implementation‑defined if the destination is a terminal. Pipe it and you’re fine (if the ls implementation claims to be POSIX™‐compliant).Are there any command line switches to format the output of ls() so that it only shows name size and time?
stat -f "%N %z %Sm" -t "%Y-%m-%d %H:%M:%S" *
find -s ./ -maxdepth 1 -printf '%20s %8Tc %f\n' # s: bytes; Tc: mod t (in locale) f: file name