Server Fault is a question and answer site for system and network administrators. 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'm using the find command find /path/on/server -mtime -1 -name '*.js' to get a list of files modified recently but I'd like the output to also have the date the files were modified

share|improve this question
up vote 2 down vote accepted

You can use the -printf option to find to print this if you want

find find /path/on/server -mtime -1 -name '*.js' -printf "%h%f %TD\n"
  • %h the leading directories
  • %f the file name
  • %TD the files modification date

the %p format specifier can be used in place of %h%f for the full path.

You get output like

/path/on/server/somefile.ext 05/24/12

There are lots of options to the printf option so you can build any output format you want.

share|improve this answer

You can customise stat to print exactly the information you like:

find /path/on/server -mtime -1 -name '*.js' -exec stat -c "%n: %y" {} \;

The way this works is that find calls stat -c "%n: %y" FILE; for every FILE that it finds in it's search, and stat prints that to your terminal.

This results in something like:

somefile.txt: 2012-06-13 02:11:59.208822237 +0100
share|improve this answer
find has a really handy -printf option – Iain Jul 5 '12 at 17:19

Like this?

find /path/on/server -mtime -1 -exec ls -l {} \;
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.