Sub topic 6
Previewing, opening, and revealing files in Finder
This chapter assumes you can already open Spotlight with Command-Space and find a file by name, as covered in the earlier chapters. It also assumes you know what a Finder window is. Here you will learn what to do after a search returns a file. Spotlight gives you three options: preview the file, open it, or reveal it in Finder, where you can see its folder and work with its neighbors.
Why the three actions matter
A search result is only a pointer to a file. Choosing the right action saves time and avoids mistakes:
- Preview lets you check that a file is the right one without launching an app. This is useful when you have several files named
reportorinvoice. - Open launches the file in its default app. Use it when you already know you want to work on the file.
- Reveal shows the file inside its folder in Finder. Use it when you want to move, rename, copy, compress, or attach the file, or when you need to know where it is stored.
Previewing a result in Spotlight
Press Command-Space and type a search. Use the Up and Down Arrow keys to move through the results. When you select a file, Spotlight shows a preview next to the list. Depending on the file type, the preview shows:
- The first page of a PDF or a document.
- A thumbnail of an image.
- A summary for a contact, a calendar event, or a message.
- Details such as the kind, size, and modification date for files that have no visual preview.
The preview comes from the same system as Quick Look, so it reads the file but does not change it. You can move down a list of similar files and watch the preview change. Often that is enough to find the right file without opening anything.
If two files look the same in the preview, check where each one lives. Hold the Command key while a file is selected, and Spotlight shows its folder path at the bottom of the preview. A path like /Users/sam/Downloads tells you more than the name does. A copy in Downloads is often an old duplicate of a file in Documents.
Opening a result
Select a result and press Return. macOS opens the file with its default app. A .pdf usually opens in Preview, a .docx in Word or Pages, and a .txt in TextEdit. Pressing Return on an app launches it, and pressing Return on a folder opens it in Finder.
You can also click a result with the mouse. The keyboard is faster because your hands stay in place after you type the query.
If the file opens in the wrong app, Spotlight is not at fault. The default app is a Finder setting. To change it for a type of file:
- Reveal the file in Finder.
- Select it and press Command-I to open the Get Info window.
- Open the Open with section and choose an app.
- Click Change All… to apply the choice to every file of that type.
To open a single file in another app once, Control-click it in Finder and choose Open With. Holding the Option key while the menu is open changes the label to Always Open With, which sets the default for that file type.
Revealing a result in Finder
Select a file in Spotlight and press Command-Return. A Finder window opens at the file's folder with the file already selected. This is the key action in this chapter, because it turns a search hit into a file you can manage.
After revealing, you can:
- Press Command-C, move to another folder, and press Option-Command-V to move the file there instead of copying it.
- Press Return to rename the file.
- Drag it into an email or a chat window.
- Press Command-Option-P to show the path bar at the bottom of the window. This shows the full chain of folders. Double-click any folder in the bar to jump to it.
You can also skip the reveal and drag the result from the Spotlight list. Dragging a file result into an open Finder window copies it there. Dragging it into an email or a document attaches or inserts it. Dragging creates a copy and leaves the original where it was.
Quick Look in Finder
Once a file is revealed, the Space bar opens Quick Look, a larger preview than the one in Spotlight. Quick Look has some extra abilities:
- Press Space again, or Escape, to close it.
- Use the arrow keys to switch to the next file in the folder while Quick Look is open.
- Press Option-Space (or Command-Option-Y) for a full-screen view of the file.
- Select several files first, then press Space to flip through them or see them in a grid.
For many file types Quick Look lets you do more than look. You can scroll through a multi-page PDF, play audio and video, and select text. Some versions show markup or rotate buttons in the Quick Look toolbar.
Quick Look does not edit files. A document that looks wrong in Quick Look may still be fine in its own app, because Quick Look uses a simplified renderer. Judge fonts and layout in the real app.
Results from a Finder search
Spotlight also works inside a Finder window. Press Command-F in Finder to start a search, and the results appear in the window. The reveal action there is named differently:
- Select a file in the results.
- Press Command-R, or Control-click and choose Show in Enclosing Folder.
Finder then jumps from the search results to the real folder. Only the file's own folder is shown, not the search. Press Command-[ (Back) to return to the results.
If you get a path bar in search results, it shows where each selected result lives. This helps when the list shows several files with the same name.
The same actions from Terminal
You can do these actions from Terminal, and they work well with mdfind from the Terminal chapter. The open command opens a file. With -R, it reveals the file in Finder. The qlmanage -p command opens a Quick Look preview.
# Open a file with its default app
open ~/Documents/report.pdf
# Reveal the same file in Finder, with the file selected
open -R ~/Documents/report.pdf
# Show a Quick Look preview, then close it with Escape or Ctrl-C
qlmanage -p ~/Documents/report.pdfTo reveal the first match of a search, pass the result of mdfind to open -R. The quotes around {} keep names with spaces working.
mdfind -name "invoice" | head -n 1 | xargs -I {} open -R "{}"If mdfind finds nothing, xargs runs open -R with no file and reports an error. That means the search failed, not the reveal.
Common problems
| Symptom | Likely cause | What to do |
|---|---|---|
| The preview pane is blank for a file | The file type has no preview, or the file is still downloading or in iCloud | Reveal it and check the size. Download it if it shows a cloud icon. |
| Command-Return does nothing | The selected result is not a file, such as a web suggestion or calculation | Choose a file or folder result and try again. |
| The file opens in the wrong app | The default app for that type is not what you want | Use Get Info, then **Open with**, then **Change All…**. |
| The revealed file is in an unexpected folder | You selected an older copy | Hold Command in Spotlight to compare paths, or check the modification date in Finder. |
| A file you just saved is missing from results | The index is out of date | See the later chapter on checking and rebuilding the index. |
Exercise
You search for "budget" and Spotlight shows two files named budget.xlsx. Describe how you would find out which one is newer, and then move that one to your Desktop, using only the actions from this chapter.
Show answer
Select the first result and hold Command to read its folder path in the preview, then do the same for the second. Press Command-Return on one to reveal it in Finder. Use Get Info (Command-I) or a Finder window's Date Modified column to compare modification dates. Repeat for the other file if needed. Once you know which file is newer, select it in the revealed Finder window and drag it to the Desktop, or press Command-C and then Option-Command-V on the Desktop to move it. Choosing a move rather than a copy avoids leaving a duplicate behind.
Exercise
What does open -R ~/Documents/report.pdf do, and how does it differ from open ~/Documents/report.pdf?
Show answer
open -R reveals the file in Finder by opening its folder with the file selected, which is the Terminal equivalent of pressing Command-Return in Spotlight. open without -R launches the file in its default app, which matches pressing Return in Spotlight.