← All posts

Preview remote files on a Mac with Quick Look

To preview remote files on a Mac, something has to fetch a temporary copy first. Quick Look, the system previewer behind the space bar in Finder, only works on files that exist on disk; it can't read from an SFTP server or an S3 bucket. What you can avoid is the manual part: downloading into a folder, finding the file, opening it, and remembering to delete it afterwards. This post shows quick ways to preview remote files from the terminal, then how a file transfer client can do the fetch-preview-clean-up cycle for you.

Why previewing remote files is awkward

Often you don't need the file, you need to know what's in it. Is this the right log? Which of these three images is the new logo? Does the config on the server still have the old database host? Downloading each candidate to answer that leaves copies of server content scattered through your Downloads folder, and some of it (database exports, logs with customer data) shouldn't be lying around on a laptop at all.

Previewing from the terminal

Text files over SSH

For text, you don't need a copy on disk. Read the file over SSH:

ssh deploy@example.com 'head -n 50 /var/www/app/.env.example'
ssh deploy@example.com 'tail -n 100 /var/log/nginx/error.log'

To read it in a proper window rather than the terminal, pipe it into open -f, which opens standard input in your default text editor:

ssh deploy@example.com 'cat /etc/nginx/nginx.conf' | open -f

Images, PDFs and other binary files

Binary files need a local copy for any previewer. Fetch to a temporary directory and preview with qlmanage, the command-line front end to Quick Look:

tmp=$(mktemp -d)
scp deploy@example.com:/var/www/app/public/logo.png "$tmp/"
qlmanage -p "$tmp/logo.png" >/dev/null 2>&1
rm -rf "$tmp"

Objects in S3

The AWS CLI can stream an object to standard output, which is handy for text:

aws s3 cp s3://example-logs/2026/10/27/app.log - | head -n 50

For anything you'd rather view in a browser, a short-lived presigned URL avoids a local copy you have to remember to delete:

aws s3 presign s3://example-assets/brochure.pdf --expires-in 300

Anyone with that URL can fetch the object until it expires, so keep the expiry short and don't paste it anywhere public.

Identifying a file without fetching it at all

Sometimes the question is only "what is this?", and the server can answer it without sending the file anywhere. The file command reads the first bytes and names the format, which is quicker than a preview for an extensionless file or a suspiciously large upload:

ssh deploy@example.com 'file /srv/uploads/incoming/* | head'
ssh deploy@example.com 'ls -lh /srv/uploads/incoming/'

To check whether a file on the server is the same as one on your Mac, compare checksums instead of opening both: shasum -a 256 locally and sha256sum on the server. Matching hashes settle the question without a single byte of the file crossing the network.

Things to watch for

Previewing remote files in Wharf

Wharf brings Quick Look to the remote pane. Right-click a file on the server and choose Quick Look, and the standard macOS Quick Look panel opens with a preview. Select several files first and they all go into the panel, so you can step through a folder of images or a set of config files.

Behind the scenes, Wharf does the fetch-and-clean-up for you:

Because it's the system Quick Look panel, it previews whatever your Mac can: images, PDFs, plain text such as logs, config files and source code, audio and video, and formats handled by any Quick Look extensions you've installed. Quick Look works the same way over SFTP, FTP, FTPS and S3, since Wharf fetches the file with whichever protocol the site uses. It's one of the browsing features listed on the features page.

If the preview shows something you need to change, right-click the same file and choose Edit in Default App instead, and every save goes back to the server; the remote editing guide explains how that works. To keep the file, use Download or drag it to the local pane or to Finder.

When a preview isn't enough

Quick Look is for a glance. For comparing a remote folder against a local one, a sync review shows sizes and dates for every difference without previewing anything; the two-way sync guide walks through it. For questions about connecting in the first place, see the support page. And if you only ever need text, the OpenSSH ssh manual page is worth a read for running one-off commands like the head and tail examples above.