5 ms·
Sure you can. 5th column of `ls -l` is size; sort can do numerical values > ls -tl | sort -k 5 -n
by ddalex 10y ago
Sure you can. 5th column of `ls -l` is size; sort can do numerical values
> ls -tl | sort -k 5 -n
- justinsaccount 10y agoNot the same thing, ls -l | sort +date,-size was to show how sorting by date ascending and size descending could work. 'sort' can sort by different fields in different orders, but to sort times properly you'd need to use ls with `--full-time` or --time-style=long-iso` which is in GNU ls but not the BSD ls on OS X. You'd end up with something like ls -l --full-time |sort -k 6,5rn But that doesn't quite work. Besides, the 'sort -k 6,5rn' instead of 'sort +date,-size' is exactly the kind of thing I was trying to show. We could have had a sort that let you do '+date,-size', instead we have a 'universal interface'.