GoTrash is a simple command-line tool written in Go that moves files to the trash instead of deleting them permanently. It act has a proxy for the rm
command, and it provides a safer alternative to the rm
command, allowing users to recover files if needed as use all rm
options.
Gotrash has only been tested on ubuntu 24.04 and 22.04, but it should work on most Linux distributions and macOS.
- Move files to the trash instead of permanently deleting them
- Simple and easy-to-use command-line tool, with a similar interface to
rm
- Compatible with most shell environments
- Option to display help information
To use GoTrash, you can either compile the source code yourself or download the precompiled binaries from the Releases page.
Clone this repository:
git clone https://github.com/h4ckm1n-dev/gotrash.git
Navigate to the repository directory:
cd gotrash
Compile the source code:
go build -o gotrash
Move the generated binary to a directory in your PATH, for example:
sudo mv gotrash /usr/local/bin
Optionaly you can alias gotrash to rm
alias rm="gotrash"
gotrash [OPTION]... [FILE]...
[OPTION]: Optional arguments, including -h or --help to display help information.
[FILE]...: List of files to move to the trash.
Move a single file to the trash:
gotrash example.txt
Move multiple files to the trash:
gotrash file1.txt file2.txt file3.txt
For more options, run:
gotrash --help
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Feel free to open issues or submit pull requests.
This project was inspired by rmtrash by Sindre Sorhus.