Linux command
trash-cli 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Move file to trash
trash-put [file]
List trashed files
trash-list
Restore file
trash-restore
Empty trash
trash-empty
Remove files older than days
trash-empty [30]
Remove specific trashed file
trash-rm [pattern]
说明
trash-cli provides a command-line interface to the FreeDesktop.org trash. It moves files to trash instead of permanently deleting them. Files are moved to ~/.local/share/Trash following the freedesktop.org specification. Desktop environments can see and restore these files. Restoration is interactive. trash-restore lists trashed files with numbers, and you select which to restore. Empty trash permanently deletes trashed files. Age-based emptying removes only old files, keeping recent deletions recoverable. The tools work with filesystem trash on external drives. Each mounted filesystem has its own trash directory. Aliasing rm to trash-put provides safer default behavior while maintaining familiar syntax.
参数
- -d, --directory
- Allow trashing directories (trash-put).
- -f, --force
- Ignore nonexistent files, do not print error messages.
- -i
- Silently ignore nonexistent files (trash-put).
- -v, --verbose
- Explain what is being done.
- --trash-dir _DIR_
- Use specified directory as trash folder instead of the default.
- --version
- Show version.
- --help
- Show help.
FAQ
What is the trash-cli command used for?
trash-cli provides a command-line interface to the FreeDesktop.org trash. It moves files to trash instead of permanently deleting them. Files are moved to ~/.local/share/Trash following the freedesktop.org specification. Desktop environments can see and restore these files. Restoration is interactive. trash-restore lists trashed files with numbers, and you select which to restore. Empty trash permanently deletes trashed files. Age-based emptying removes only old files, keeping recent deletions recoverable. The tools work with filesystem trash on external drives. Each mounted filesystem has its own trash directory. Aliasing rm to trash-put provides safer default behavior while maintaining familiar syntax.
How do I run a basic trash-cli example?
Run `trash-put [file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -d, --directory do in trash-cli?
Allow trashing directories (trash-put).