I want to be able to list files showing the number of lines the each file has and the date. I can happily get the line count using wc -l *
. Not a problem. I can get the date using ls -l
.
Is there a way to combine the two commands to give me a single output in columns?
Best Answer
Here is something with
find
+wc
+date
.Instead of
date -r
one can also use for examplestat -c%y
.The output looks like this:
Using this as starting point one can create a function which accepts directory and pattern as parameters:
After that
myls /tmp '*.png'
will list only images from/tmp
(notice single quotes around pattern to prevent shell from expanding a glob operator*
).