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). I believe libxo(3) support will return eventually.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" *
LINE_MAX). Since FreeBSD version 15.0 find(1) output can be formatted.# -s : traverse file hierarchy in lexicographic order
# %20s : file size in bytes, padded with leading space so it occupies 20 cells
# %8Tc : file’s modification time expressed as preferred in current locale
# %f : file name
find -s ./ -maxdepth 1 -printf '%20s %8Tc %f\n'
Another way to do this would be:
ls -l |awk '{if (NF == 9) {print $9, $5, $6, $7}}'