Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 have a directory, let's call it htdocs/live/. Many different directories are underneath this directory, each with a file commonFunctions.js living in the js directory.

For example, here is the structure of a few of the directories containing commonFunctions.js:


How can I write a command to list each of these files ordering them by the last time they were modified?

share|improve this question
up vote 2 down vote accepted

are you thinking of something like ls -alt htdocs/live/*/js/commonFunctions.js ?

share|improve this answer
I did not know you could use the * in ls like that. This is exactly what I needed. – bvpx Oct 14 '13 at 21:11
Incidentally, the * is a function of the shell, not ls. You can use this with any shell command :) – MattJenko Oct 15 '13 at 7:49

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.