How can I find which Homebrew package a certain file/binary belongs to (if any)? [duplicate]

If the file was installed by Homebrew, it is a symlink to a file in /usr/local/Cellar/:

$ ls -l /usr/local/share/info/bash.info
lrwxr-xr-x  1 admin  wheel  45 Mar 15 15:25 /usr/local/share/info/bash.info -> ../../Cellar/bash/4.2.45/share/info/bash.info

It's also possible that the file was not installed by Homebrew. /usr/local/ is often the default installation target in makefiles, and it is also used by installers and by other package managers like pip.