Find the name and path of a file with Spotlight

Find the name and path of a file with Spotlight
Mac Tip #568, Wednesday, 30 January 2013

You may use Spotlight to find a file on your Mac. In Mountain Lion (and perhaps earlier versions of the OS) simply highlighting the file will usually give a quick preview of its contents, and pressing Return will open it. But what say you want to know the exact filename or where the file is located? You can do that too. Here’s how.

Quick Start

  1. Make sure Spotlight indexing is on.
  2. Select a search result item to see a preview of the file.
  3. Press Return to open a selected search result.
  4. Press and hold the Command key to see the file name and path of the selected search result.
  5. Command click on a search result to open the file’s containing folder.

If this Tip was useful, please leave a comment letting us know. Want more detail? Read the full Tip below.


Please subscribe to the MacTips channel. Or just visit this video on YouTube, leave comments and rate it, as that helps spread the word about MacTips.

Find a file with Spotlight

At the right-hand end of your Mac’s menu bar is a magnifying glass icon: that’s Spotlight. Click it and a Search bar appears.

Type one or more words you know to be in the name or contents of a file on your computer. As you type a list of possible search results appears below the search box.

Note: if you’ve turned Spotlight indexing off for all or part of your hard drive Spotlight may not find the file. Check System Preferences > Spotlight if you fail to find a file you know for sure is on your hard drive. Check both the Search Results and Privacy tabs.

For example, I searched on lorem january, knowing that somewhere on my Mac I have a document whose filename includes those words.

Spotlight - the preview of the selected search result shows the file path at the bottom.

Spotlight – the preview of the selected search result shows the file path at the bottom because I was holding down the Command key.

Preview and open a found file

Once you locate the correct file in Spotlight’s list of search results click on it or use the arrow keys to highlight it, then press the Return key to open it.

When you highlight an item you may automatically see a preview of the file’s contents appear beside the selected item in the search results list. This is very handy for helping you to identify the correct file.

It may not be obvious, but you can scroll through the preview of the file in the normal way.

See the full filename, path or URL of a found file

With the preview described above visible press and hold the Command (⌘) key. A grey bar appears at the bottom of the preview window and displays the full filename of the file.

Continue to hold down the Command (⌘) key and after a moment the filename disappears to be replaced by the path of the file.

If the search result is for a web page then you see the URL rather than a file path.

For example, my search for lorem january found as a possible result the file lorem-january-2013.rtf. When I held down the Command (⌘) key that filename appeared below the preview, but a moment later the filename was replaced by miraz > Demo.

That tells me the file named lorem-january-2013.rtf is located in a folder named Demo in my Home (miraz) folder.

Instead of just pressing and holding the Command key and waiting you can keep the Command key down and press the Option (⌥) key to see the path.

You may find it amusing or interesting to experiment on various search results, such as music tracks, web pages, folders, apps and other types of result.

Command click on a search result to open the file’s containing folder

When you see a file listed in the Spotlight search results try holding down the Command key and clicking on the selected result. The folder that contains that file opens and the file is selected in the folder.

More on Spotlight

Want to learn more about using Spotlight on your Mac? While I haven’t yet read this particular book, the whole Take Control series is superb and I recommend any one of the series. Click the image to buy the book and support MacTips with the small affiliate reward.

Buy Take Control of Spotlight for Finding Anything on Your Mac.

From the book’s product page:

This ebook was written with 10.7 Lion in mind, and now that 10.8 Mountain Lion has shipped, I’m happy to report that the ebook remains spot on for searching in Mountain Lion. Sharon reports, “There are some “anachronisms”—references to Address Book, which is now Contacts, for instance. But there aren’t any major, or even minor, changes to procedures or dialogs or anything. Good to go! — Tonya Engst

Related posts

[wpzon keywords="pressure cooker" sindex="PCHardware" snode="1232597011" sort="salesrank" listing="8"]

One Comment;

  1. Julia said:

    Thanks for the tip about how to get the path in spotlight. I’ve been incredibly irritated by Spotlight presuming you want to open a file rather than just locate it for attachment.

Comments are closed.