Linux command
trash 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Send
trash [path/to/file]
List
trash-list
Interactively restore
trash-restore
Empty
trash-empty
Example
trash-empty 10
Remove
trash-rm "*.o"
Example
trash-rm /[path/to/file_or_directory]
说明
trash-cli is a command-line interface to the FreeDesktop.org Trash specification, providing a safer alternative to rm by moving files to a recoverable trash location instead of permanent deletion. The trash follows XDG standards and integrates with desktop file managers. Files can be restored to their original location using trash-restore, which presents an interactive menu of trashed items. The trash-empty command permanently deletes items from the trash, with optional age filtering.
参数
- trash _files_
- Move files to trash (alias: trash-put)
- trash-list
- List files in trash with original path and deletion date
- trash-restore
- Interactively restore files from trash
- trash-empty _days_
- Empty trash, optionally only files older than days
- trash-rm _pattern_
- Remove files from trash matching pattern or original path
- -d, --directory
- Remove empty directories
- -f, --force
- Ignore nonexistent files
- -v, --verbose
- Explain what is being done
- --trash-dir _dir_
- Use specified trash directory instead of the default.
- --version
- Show the program's version number and exit.
FAQ
What is the trash command used for?
trash-cli is a command-line interface to the FreeDesktop.org Trash specification, providing a safer alternative to rm by moving files to a recoverable trash location instead of permanent deletion. The trash follows XDG standards and integrates with desktop file managers. Files can be restored to their original location using trash-restore, which presents an interactive menu of trashed items. The trash-empty command permanently deletes items from the trash, with optional age filtering.
How do I run a basic trash example?
Run `trash [path/to/file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does trash _files_ do in trash?
Move files to trash (alias: trash-put)