Apple - How do I "Get Info" from the command line?
mdls
lists the metadata attributes of a given file. Try this:
mdls -name kMDItemWhereFroms filename
According to this article about command line tricks you can do the following:
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent' | grep YOURFILENAME
Just exchange YOURFILENAME with the file you want to check.