Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can easily find files with given string in name:

me@comp:/usr/local/hydra/hydra-7.4.2$ find -D stat -name "*hack*"

How can I also print file details, like size, date of creation etc.?

share|improve this question
up vote 8 down vote accepted

Just use -printf parameter with proper arguments:

me@comp:/usr/local/hydra/hydra-7.4.2$ man find

me@comp:/usr/local/hydra/hydra-7.4.2$ find -name "*hack*" **-printf** '%m %p %a\n'

644 ./hack881663129.txt Sat Feb 16 02:27:16.0189270840 2013
644 ./hack881663129_7.txt Sat Feb 16 05:30:12.0673185691 2013
644 ./hack881663129_5.txt Sat Feb 16 05:24:57.0441188136 2013
644 ./hack881663129_4.txt Sat Feb 16 05:22:21.0209189346 2013
664 ./hack881663129_4_7.txt Wed Feb 20 11:09:49.0786644191 2013
644 ./hack881663129_6.txt Sat Feb 16 05:26:49.0297187267 2013
664 ./hack881663129_1_6.txt Mon Feb 18 11:40:05.0991189262 2013
644 ./hack881663129_8.txt Sat Feb 16 05:31:37.0689185031 2013

me@comp:/usr/local/hydra/hydra-7.4.2$ vi hack881663129_4_7.txt

(See man find.)

share|improve this answer

Execute stat for every file found:

find . -name '*hack*' -exec stat {} \;

The same, using xargs:

find . -name '*hack*' | xargs stat

Better, when there are delimiter characters in the filenames:

find . -name '*hack*' -print0 | xargs -0 stat
share|improve this answer

Your Answer


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.