# 使用 Homebrew, apk, apt, dnf, Nix, pacman, zypper, MacPorts 安装 trash-cli

查看 trash-cli 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:trash-cli
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install trash-cli
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install trash
```

  证据: MacPorts ports tree: sysutils/trash/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add trash-cli
```

  证据: Alpine Linux edge package indexes: trash-cli from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install trash-cli
```

  证据: Debian stable package indexes: trash-cli from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install trash-cli
```

  证据: Fedora Rawhide package metadata: trash-cli from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#trash-cli
```

  证据: nixpkgs package indexes: pkgs/by-name/tr/trash-cli/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S trash-cli
```

  证据: Arch Linux sync databases: trash-cli from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install trash-cli
```

  证据: openSUSE Tumbleweed package metadata: trash-cli from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

## 软件包事实

- **软件包键:** brew:trash-cli
- **软件包管理器:** Homebrew
- **版本:** 0.24.5.26
- **来源摘要:** Command-line interface to the freedesktop.org trashcan
- **主页:** <https://github.com/andreafrancia/trash-cli>
- **仓库:** <https://github.com/andreafrancia/trash-cli>
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- trash (别名)
- trash-empty (别名)
- trash-list (别名)
- trash-put (别名)
- trash-restore (别名)
- trash-rm (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 0.24.5.26
## 项目历史与用法

trash-cli is a Python command-line interface to the freedesktop.org trash can. Its README describes a suite of commands for moving files to trash, listing trashed files, restoring them, emptying trash, and removing matching trashed entries while preserving metadata such as original path, deletion date, and permissions.

### 项目历史

The project grew out of the Unix command-line gap between irreversible `rm` and desktop trash implementations. The official README frames trash-cli as a command-line and scripting interface to the same trash can used by KDE, GNOME, and XFCE, making desktop-style file recovery available from shells and scripts.

GitHub repository metadata identifies `andreafrancia/trash-cli` as an official source repository created in 2011, while the README examples still show older usage dates from 2007 and 2008. The project has continued to publish tagged versions and maintain Python packaging instructions, with the README recommending pipx or pip, source installs from Git, and distro package managers.

### 采用历史

trash-cli moved from being a convenience wrapper for freedesktop.org trash semantics into a broadly packaged Unix utility. The official README lists package-manager installation commands for Debian/Ubuntu, Arch Linux, and Fedora, and the batch input additionally records availability in Homebrew, apk, Debian, dnf, MacPorts, Nix, pacman, Ubuntu, and zypper.

The package's adoption is tied to cross-desktop Linux behavior: by using the freedesktop.org trash location and metadata model, it fits systems where graphical file managers and command-line tools need to see the same trash state.

### 使用方式

Typical use is replacing ad hoc destructive cleanup with explicit trash operations: `trash-put` sends files or directories to the trash, `trash-list` supports shell filtering, `trash-restore` interactively restores entries, `trash-empty` clears trash or old entries, and `trash-rm` removes trashed files matching patterns.

The README explicitly warns against aliasing `rm` directly to `trash-put` because the commands have different semantics, including directory handling. Instead it suggests using shell aliases that remind users not to run `rm`, and it documents cron-based automatic deletion with `trash-empty 30`.

### 为什么软件包爱好者会关心

For package-manager users, trash-cli is the portable Linux answer to safer deletion from scripts and terminals. It matters because it integrates with the desktop trash standard rather than inventing a private holding directory, so it can be packaged once and behave consistently across common Unix desktops.

The formula is also a good example of a small CLI whose executable surface is intentionally split into subcommands, making it easy for downstream packagers and shell users to expose focused tools instead of one large interactive program.

### 时间线

- 2007-2008: README examples show early trash-list and trash-empty workflows.
- 2011: Official GitHub repository metadata records creation of `andreafrancia/trash-cli`.
- 2020s: README documents pipx, pip, Git source installs, and distribution package-manager installs.

### Related projects

- Related to freedesktop.org trash implementations used by KDE, GNOME, and XFCE.
- Contrasts with `rm`, which permanently unlinks files rather than recording trash metadata for recovery.
- Complements macOS-specific tools such as Ali Rantakari's `trash`, which targets Finder and macOS Trash behavior.

### 来源

- Batch input fields: source_facts.description, source_facts.executables, source_facts.package-manager
- Official GitHub repository metadata: https://github.com/andreafrancia/trash-cli
- Official README: https://github.com/andreafrancia/trash-cli#readme


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals

## 其他软件包管理器记录

- Debian apt - trash-cli - 0.24.5.26-0.3: normalized package name match | Debian stable package indexes: trash-cli from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | command line trashcan utility | https://github.com/andreafrancia/trash-cli
- Nix - trash-cli: normalized package name match | nixpkgs package indexes: pkgs/by-name/tr/trash-cli/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - trash-cli - 0.23.11.10-1: normalized package name match | Ubuntu 24.04 LTS package indexes: trash-cli from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | command line trashcan utility | https://github.com/andreafrancia/trash-cli
- apk - trash-cli - 0.24.5.26-r1: normalized package name match | Alpine Linux edge package indexes: trash-cli from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Command line interface to the freedesktop.org trashcan | https://github.com/andreafrancia/trash-cli
- apk - trash-cli-doc - 0.24.5.26-r1: normalized package name match | Alpine Linux edge package indexes: trash-cli-doc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Command line interface to the freedesktop.org trashcan (documentation) | https://github.com/andreafrancia/trash-cli
- apk - trash-cli-pyc - 0.24.5.26-r1: normalized package name match | Alpine Linux edge package indexes: trash-cli-pyc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Precompiled Python bytecode for trash-cli | https://github.com/andreafrancia/trash-cli
- dnf - trash-cli - 0.24.5.26-21.fc45: normalized package name match | Fedora Rawhide package metadata: trash-cli from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Command line interface to the freedesktop.org trashcan | https://github.com/andreafrancia/trash-cli
- pacman - trash-cli - 0.24.5.26-3: normalized package name match | Arch Linux sync databases: trash-cli from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | Command line trashcan (recycle bin) interface | https://github.com/andreafrancia/trash-cli
- zypper - trash-cli - 0.24.5.26-1.5: normalized package name match | openSUSE Tumbleweed package metadata: trash-cli from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Command line interface to the freedesktop.org trashcan | https://github.com/andreafrancia/trash-cli
- MacPorts - trash: installed executable or alias match | MacPorts ports tree: sysutils/trash/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## Combined YAML source

View the package source record on GitHub. [combined/trash-cli.yml](https://github.com/mxcl/pkgdb/blob/main/combined/trash-cli.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
