Help in understanding a command line search of all sqlite files on os x device I was listening to a Talk Python To Me podcast that had Simon Willison as the guest. Willison discussed two projects he is developing, Datasette and DogSheep Beta, both of which allow you pull in data as an SQLite database (Datasette) and then index and query it (DogSheep Beta). All your data include Apple Watch data, texts, photo data including lat/long and even the scoring Apple uses to rank your photos.
The two links here are really interesting and I recommend them.
The problem I'm having finding .sqlite files. The directions and the YouTube say to install Datasette and point it against a database on your laptop.  I know I can use the Finder for files but I'd like to follow along with youtube.
At around 5:31 in his PyCon AU talk, he types out:
mdfind &quot;kMDItemDisplayName ==*.sqlite&quot; -0 | xargs -0 stat &quot;-f%z %N&quot; | sort -nr | head -n 20
I managed to read the incantation but while I get the gist, there are a number of details that Apple's CLI help pages don't cover.
So, here are my questions:

What is the -0 flag, specifically? (as opposed to the overly brief example Apple gives)
What does xargs -0 stat &quot;-f%z %N&quot; mean?
-nr what are the n and r flags for sort?
finally (and you probably guessed it with order) what is -n flag for head?
There are details in man pages for those arguments.
From man mdfind:

-0          Prints an ASCII NUL character after each result path.  This is useful when used in conjunction with xargs -0.

From man xargs:

-0      Change xargs to expect NUL (``\0'') characters as separators, instead of spaces and newlines.  This is expected to be used in concert with the -print0 function in find(1).

From man stat:

-f format
Display information using the specified format.  See the FORMATS section for a description of valid formats.


z       The size of file in bytes.


N       Displays the name of file.

From man sort:

-n, --numeric-sort, --sort=numeric
Sort fields numerically by arithmetic value.  Fields are supposed to have optional blanks in the beginning, an optional minus sign, zero or more digits (including decimal point and possible thou-
sand separators).


-r, --reverse
Sort in reverse order.

From man head:

head [-n count | -c bytes] [file ...] This filter displays the first count lines or bytes of each of the specified files

So to break it down:

mdfind finds all .sqlite files and appends NUL char to each line
xargs displays the results in format NUMBER_OF_BYTES FILE_PATH
sort sorts the results by NUMBER_OF_BYTES descending
head displays top 20 results