How to find tagged files/folders using the command line in Terminal?
The correct command to perform Spotlight searches on the macOS Terminal command line is mdfind.
mdfind &quot;kMDItemUserTags == '&lt;your_tags_here&gt;'&quot;

The list all the kMD codes:
mdimport -A