When you type a word into a Spotlight search field on your Mac, your Mac will perform a search of the contents of your files by default. Personally, I tend to search for files by file name most often. Here’s an easy way to get your Mac to search by file name instead of file content. Simply add “name:” before your search term. For example, if you want to find a file on your Mac whose filename contains the word penguin type in name:penguin.
Please be aware that you do not want to insert a space between the colon and the search term. Use the two images below as guides.
If you click on the Spotlight magnifying glass icon in the upper right corner of your Mac, then you could type in name:penguin.
If you use the Spotlight Search field that appears in the upper right corner of a Finder window you could type in name:penguin.