Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What is the best and fastest way to get a list of every file on OS X including hidden and system files along with their attributes? I'm not afraid of the terminal or scripts, but if there is a wonderful audit-like application out there I'd be interested in comparing that to my options.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Depends on what attributes you need, but the standard unix way would be:

find / -type f -print0 | xargs -0 stat

You mention auditing, so something like tripwire may fit your needs better.

share|improve this answer
1  
I would also recommend adding the > all_my_files.txt at the end. That way you can view the data at a later date too. –  ricbax Nov 25 '09 at 2:22
    
For me, the results are without extended attributes. –  Graham Perrin Jul 17 '12 at 6:05
    
Why pipe to tough xargs? Why not find /path/to/search/ -type f -exec stat {} \; ? –  Hennes Sep 30 '13 at 22:50

To list extended attributes and file flags for all files on all devices:

sudo find / -exec ls -ldO@ {} \;

(that's an upper case letter O in the "-ldO@").

To include access control lists (ACLs), the -e option of ls:

sudo find / -exec ls -ldeO@ {} \;

If a device is a Filesytem in Userspace with no allowance for root, then the commands above will not succeed for that device.

For the listing to exclude devices other than the startup volume, the -x option of find:

sudo find -x / -exec ls -ldeO@ {} \;
share|improve this answer

You can use mdfind.

Find files matching a single query.

share|improve this answer
    
mdfind does not search system directores by default. –  Chealion Nov 25 '09 at 2:21
    
so that means you can set something to let it search for system directories, right? –  user31894 Nov 27 '09 at 10:56
    
mdfind does list some system files that the Spotlight menu and Finder don't, but there are some files that don't even seem to be indexed by Spotlight. You can also include some additional hidden files in the mdfind results by setting kMDItemFSInvisible to true. –  ؘؘؘ Jul 17 '12 at 17:05

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.