Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Anyone know if there is a program for Linux that acts like locate / updatedb and family but includes file sizes and permissions?

I know find can do this, but I am looking for something that puts all this information in a db so the information could be looked up quickly.

The idea being, for example, that you could find out the size of directories (at the the time updatedb) etc very quickly if there was a system like this. I don't want to just run stat or ls on locates output.

share|improve this question
    
Are you averse to putting the filesizes into a DB? –  Andy Jul 23 '09 at 16:19
    
Andy: Well, basically, that means doing this myself, or extended locate. Which fine and I could do, I was just curious if something was out there already. –  Kyle Brandt Jul 23 '09 at 17:38

3 Answers 3

You could always

ls -l `locate orderack`
share|improve this answer
    
Updated Question :-) –  Kyle Brandt Jul 23 '09 at 15:33
    
Updated answer :) –  Andy Jul 23 '09 at 15:43
    
You make me sad. Like, really sad. "find / -name file.txt -print0 | xargs -0 ls -l" is marginly better, so you don't end up forking ls for every single file. Even better would be using "find / -name file.txt -printf '%y%M %u %g %s %p\n'". The formatting isn't exactly the same as ls -l, but it should be pretty close. This saves forks and stat syscalls. –  David Pashley Jul 23 '09 at 15:45
    
and now you've changed your answer to make my comment look out of place. :( –  David Pashley Jul 23 '09 at 15:46
    
Doesn't really matter, maybe I am not explaining this well, but I want the size of the files and the permissions to be in the DB. I doubt ls -l $(locate foo) would be much faster (if not slower) than the find command.. –  Kyle Brandt Jul 23 '09 at 15:54

for file in $(locate BLAH); do ls -lah $file; done

I believe this prevents forking, but I can't be certain.it was quite fast for me.

share|improve this answer
    
You need to quote $file or spaces will break it. –  David Pashley Jul 24 '09 at 7:42
    
Oh and you are still forking ls for every file. –  David Pashley Jul 24 '09 at 7:43
    
"locate -0 foo | xargs -0 ls -l" should be both efficient and space-safe. –  David Pashley Jul 24 '09 at 7:45

It's not exactly what you're looking for, but this should work:

locate <pattern> | xargs ls -lh
share|improve this answer

Your Answer

 
discard

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.