1

I would like to list all files on my system from command line.

The provided BSD find command, with the following command line

sudo find / 

lists many of the files twice, under the root and under /System/Volumes/Data.

The GNU find command, installed with Homebrew, with the following command line

sudo gfind /

does not list files under /Applications, /Users, /Volumes and others.
The command

sudo gfind /*

lists more file, but I am not sure if they are all.

I would like to list all files once and preferably with GNU find, because differently from BSD find has a -printf command with many output formats, like inode, size, separated path and filename, unified timestamp and others.

2
  • 1
    About your last sentence, try find / -ls.
    – lhf
    May 17 '20 at 19:32
  • @lhf, yes, but the output should then be parsed, and still a sortable timestamp is not directly present
    – enzotib
    May 18 '20 at 8:27
1

My best solution is the following (for bash shell)

shopt -s dotglob
for f in /* 
  sudo gfind "$f" -path /System/Volumes/Data -prune -o -print 2>/dev/null
done
shopt -u dotglob

where, in place of -print, one can use several other commands.

The most part of files in /System/Volumes/Data are the same as in /, with few and not much interesting additions.

Moreover, the more compact solution gfind /* does not work well, because produces many loops that prevent the listing of many parts of the full listing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .