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

Is there a way to display all the information that -l does in ls (permissions, dates, etc.) when using the locate or find commands?

share|improve this question
up vote 7 down vote accepted

Not just for "ls -l" but for whatever action you'd want to perform to your locate or find results you can use xargs or in the case of find the -exec flag. Here are examples to achieve what you want to do:

In the case of locate you can use xargs:

locate something | xargs ls -l

Xargs can be used for find too, but find has the -exec flag that allow to optimize further actions with find results; for example

find . -iname something -exec ls -l '{}' \;
share|improve this answer
This is the more general approach compare to mine. But I would generally recommend to use xargs for find as well, as it handles large result sets better (-exec spawns a new process for every file while xargs groups them to create as few processes as possible). – Sven Aug 5 '11 at 15:52
When find returns a huge amount of lines you might have problems to buffer all of them. Also with -exec you process the result as soon as it appears and you don't have to wait the end of the find process to start the xargs part. – hmontoliu Aug 5 '11 at 15:55
if execing things I find it better to use + e.g. find . -exec ls -l '{}' +. This reduces the number of calls to exec as + puts many of the files found on one command line. – Iain Aug 5 '11 at 16:04
xargs starts working as soon as it has enough data. – Sven Aug 5 '11 at 16:05
Awesome - this is exactly what I wanted to know and am going to go learn more about xargs. Thanks! – Ryan Jurgensen Aug 5 '11 at 16:20

I am not sure what you want to do, but try

find . -ls 
share|improve this answer

You can use -printf and a suitable format string

 find ./ -printf "%M\t%n\t%u\t%g\t%s\t%t%f\n"
  • %M Symbolic permissions
  • %n hard links
  • %u username or numeric user id
  • %g group name or numeric group id
  • %s file size in bytes
  • %t last modification time
  • %f filename
share|improve this answer

One more option:

find | while read a; do ls -l "$a"; done
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.