3

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.

0
2

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.

3
  • 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
  • 1
    Why pipe to tough xargs? Why not find /path/to/search/ -type f -exec stat {} \; ? – Hennes Sep 30 '13 at 22:50
2

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@ {} \;
0

You can use mdfind.

Find files matching a single query.

3
  • 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. – Lri Jul 17 '12 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.