Move a File to the Trash from the Terminal (Recoverable)

Delete with a safety net: Finder moves the file to the Trash instead of erasing it.

macOStrashosascriptFilesMedium risk
Run the osascript Finder delete one-liner with the full path to send the file to the Trash.

01Command

Command
$ osascript -e 'tell application "Finder" to delete POSIX file "/Users/you/Desktop/old-report.pdf"'

02What it does

rm is permanent, but Finder's delete puts the file in the Trash where you can put it back — the right default when scripting cleanups. The path must be absolute, and defining a trash() helper in your shell profile makes it reusable in scripts. Empty the Trash later to actually reclaim space.

03Risk

RiskMedium risk
!Warning: Files stay on disk until the Trash is emptied — deleting large files this way does not free space immediately.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

Last verified: 2026-09-18 · Category: Files & Folders

06Related solutions