trash

Move files and directories to the user trash folder.

Syntax
 trash [-h] [--help] [-s] [-stopOnError] [-v] [--verbose] FILE [FILE...]
Key
 -s
 --stopOnError
 Exit with an error if any move to a trash folder fails
 -h
 --help
 Display usage information for the tool and exit
 -v
 --verbose
 Display more verbose status

Bugs: While the correct files do get deleted, changes made with this trash utility may not be correctly reflected by MacOS finder [source].

First appeared in macOS 14.0

Examples

Moves a file and directory into the user's trash folder, if the trash folder exists and permissions allow the items to be moved into the trash:

trash demo.txt folder1

"I don't understand why when we destroy something created by man we call it vandalism, but when we created by nature we call it progress" ~ Ed Begley Jr

Related macOS commands

Local man page: trash - Command line help page on your local machine.
brew install trash - An alternative command-line trash utility by Ali Rantakari.
rm - Remove files.
rmdir - Remove empty folder.
srm - Securely remove files or directories.

(追記) (追記ここまで)
Copyright © 1999-2026 SS64.com
Some rights reserved

AltStyle によって変換されたページ (->オリジナル) /