Copy a List of File Names to the Clipboard
Send folder listings or command output straight to the macOS clipboard.
Run `ls -1 <folder> | pbcopy` and paste the names anywhere; use `pbpaste` to read the clipboard back.
01Command
Command
$ ls -1 ~/Downloads | pbcopy02What it does
`pbcopy` reads standard input onto the pasteboard, so any listing can become clipboard text — filter with grep first to copy only PDFs, or use `find . -type f -name '*.png' | pbcopy` for a recursive list. The companion `pbpaste` lets scripts read the clipboard too.
03Risk
!Warning: `ls -1` gives names only; add `ls -d */*` style paths or `find` if you need full paths. The clipboard is shared system-wide — the next copy anywhere overwrites it.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- pbcopy – Copy data to the clipboardEvidence: pbcopy reads stdin into the macOS pasteboard
Last verified: 2026-09-18 · Category: Files & Folders
06Related solutions
Find files larger than 500 MB on Mac
List the biggest files in your home folder that are eating disk space.
Show file extensions for all files on Mac
Make Finder display .pdf, .docx, .png and every other extension at all times.
Find Which Process Has a File or Volume Open with lsof
List every open file descriptor — files, directories, and network sockets — per process.