Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to change the order of displayed columns when running ls -l on *nix (or dir on Windows)?

For example, I'd like to see the date modified, then the name, then other fields (or select only the ones I want, and their order.

How would this be done without merely using cut and trimming undesired fields (since that does not address the issue of re-ordering)?

share|improve this question
1  
as a note regarding cut, you'd get more milage out of awk in this case. ls -al | awk '{print $3 " " $1}' –  Sirex Jul 15 '11 at 11:27
add comment

1 Answer

I'd avoid parsing ls at all: use stat and sort:

stat --printf="%y\t%n\t%F\t%s\n" * | sort -t $'\t' -k 2

is a start.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.