Linux ls to show only filename date and size
Why not use stat
instead of ls
?
stat -c "%y %s %n" *
You can get a lot of control about how you list files with the find
utility. ls
doesn't really let you specify the columns you want.
For example:
$ find . -maxdepth 1 -printf '%CY%Cm%Cd.%CH%CM\t%s\t%f\n'
20111007.0601 4096 .
20111007.0601 2 b
20111001.1322 4096 a
The argument to the printf
action is a detailed in the manpage. You can choose different time information, what size you want (file size or disk blocks used), etc. You can also make this safe for unusual file names if further processing is needed.
You could always use another utility like awk
to format the output of ls
1:
/bin/ls -ls | awk '{print $7,$8,$9}'
1.Yes, generally, you shouldn't parse the output of ls but in this case the question specifically calls for it...