How to find tagged files/folders using the command line in Terminal?

Solution 1:

The correct command to perform Spotlight searches on the macOS Terminal command line is mdfind.

mdfind "kMDItemUserTags == '<your_tags_here>'"

The list all the kMD codes:

mdimport -A

Solution 2:

Turns out you can do something as simple as:

mdfind 'tag:Blue' 

Although this will only work in English locales

See this excellent answer that happens to discuss tags: https://stackoverflow.com/a/30281424/404459