Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Command-Line Apps
  3. trash-cli

trash-cli

MITJavaScriptv7.2.0

A cross-platform CLI tool that safely moves files and folders to the trash instead of permanently deleting them.

GitHubGitHub
1.4k stars38 forks0 contributors

What is trash-cli?

trash-cli is a cross-platform command-line tool that moves files and folders to the system trash instead of permanently deleting them. It provides a safer alternative to the `rm` command by making file deletion reversible, preventing accidental data loss while maintaining command-line convenience.

Target Audience

Developers and command-line users who regularly delete files via terminal and want a safer, recoverable alternative to permanent deletion commands.

Value Proposition

Unlike traditional deletion tools, trash-cli prioritizes safety by moving files to the trash where they can be recovered, reducing the risk of accidental data loss while maintaining the efficiency of command-line workflows.

Overview

Move files and folders to the trash

Use Cases

Best For

  • Safely deleting files from the command line without permanent removal
  • Replacing the dangerous `rm` command with a reversible alternative
  • Managing file deletions across multiple operating systems consistently
  • Using glob patterns to selectively move files to trash
  • Preventing accidental data loss during terminal file operations
  • Creating safer aliases for common deletion commands in shell configurations

Not Ideal For

  • Scripts requiring immediate, permanent deletion of sensitive data to prevent any recovery
  • Automated cleanup in CI/CD pipelines where trash accumulation could waste disk space or cause issues
  • Environments without Node.js installed or where installing npm packages is restricted or impractical
  • Users who need fine-grained control over trash behavior, such as custom trash locations or bypassing system trash

Pros & Cons

Pros

Cross-Platform Safety

Works consistently on macOS, Linux, and Windows by moving files to the system trash, providing a safer alternative to 'rm' across different operating systems as highlighted in the README.

Globbing Flexibility

Accepts both file paths and glob patterns like '*.png' for batch operations, with support for dotfile matching via the --dot flag, enabling efficient and selective file trashing.

Verbose Transparency

Includes a --verbose option to print trashed items, offering clear feedback and confirmation of actions, which reduces uncertainty in command-line operations.

Shell Alias Integration

Can be easily aliased to replace 'rm' in shell configurations (e.g., .bashrc), promoting safer deletion habits without extra typing, as suggested in the README's Tip section.

Cons

Node.js Dependency

Requires Node.js and npm for installation, adding setup complexity and overhead compared to native shell commands, which may not be ideal for minimal or restricted environments.

No Permanent Deletion

Lacks an option for immediate, irreversible deletion; users needing to permanently remove files must rely on separate tools like del-cli or native commands, limiting its utility for secure data disposal.

System Trash Reliance

Depends on the underlying OS's trash implementation, which can vary in reliability, capacity, or availability, potentially leading to inconsistencies or issues on some systems, despite cross-platform claims.

Frequently Asked Questions

Quick Stats

Stars1,397
Forks38
Contributors0
Open Issues2
Last commit2 months ago
CreatedSince 2015

Tags

#glob-patterns#productivity#file-management#command-line-tool#cli-utility#cross-platform

Built With

N
Node.js

Included in

Command-Line Apps19.2k
Auto-fetched 1 day ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub