Trash can in CLI
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
help.go Change keymap and ditto May 21, 2015

gomi is a simple trash tool that works on CLI, written in Go


The concept of the trashcan does not exist in Command-line interface (CLI). If you have deleted an important file by mistake with the rm command, it would be difficult to restore. Then, it's this gomi. Unlike rm command, it is possible to easily restore deleted files because gomi have the trashcan for the CLI. It is also possible to work with trashcan for Graphical user interface (GUI).



*1 gomi means a trash in Japanese.

*2 It was heavily inspired by peco/peco and mattn/gof.


  • Easy to restore (thanks to peco-like interface)
  • Quick preview feature
  • Customizes TOML format configuration file
  • Interacts nicely with Trash
  • Supports Put Back
  • A single binary
  • Cross-platform CLI app

Quick Look

Before you restore a file that was discarded from the trashcan, gomi has a function that browse the contents of the file. It is almost the same as the Quick Look of OS X. If the discarded file is a directory, it is recursively scan its contents and make the files and subdirectories list.

To QuickLook, type the C-q in Restore mode. Available key map is here: Keymap


Put Back

gomi supports Put Back. Because it is possible to combine the GUI trashcan with gomi, it is possible to restore the discard file from the GUI menu. Currently it has supported OS X only.

Put Back

Works on Windows

gomi is a Cross-platform application. Basically, you can also use Windows. In the future, it will be possible to combine the Recycle Bin with gomi. We welcome your pull request.



Basic usage is...

  1. Remove! Throw away the trash 📦

     $ gomi files
  2. Restore! Scavenge the trash 🔍

     $ gomi -r

It is able to replace rm with gomi. However, on the characteristics of it, it dosen't have options such as -f and -i at all. The available option is -r.

To actually delete rather than the trash:

$ gomi ~/.gomi/2015/05/01/gomi_file.13_55_01

Run twice.

To specify the location where you want to restore:

$ gomi -r .

In the above example, it's restored to the current directory.

For more information, see gomi --help.


Keys Actions
Enter Restore a file under the cursor or selected files
C-c, Esc Exit from Restore mode or Quick Look mode with success status
C-n, Down Move the selected line cursor to one line below
C-p, Up Move the selected line cursor to one line above
C-f, Right Move caret forward 1 character
C-b, Left Move caret backward 1 character
C-a Move caret to the beginning of line
C-e Move caret to the end of line
BackSpace Delete one character backward
C-u Delete the characters under the cursor backward until the beginning of the line
C-w Delete one word backward
C-l Redraws the screen
C-q Toggle Quick Look
C-i, Tab Toggle showing help message about gomi
C-v Select multiple lines
C-_ Remove a file under the cursor or selected files


The installation script requires bash 3+:

$ curl -L | bash

If you want to go the Go way (install in GOPATH/bin) and just want the command:

$ go get -u

Mac OS X / Homebrew

If you're on OS X and want to use Homebrew:

$ brew tap b4b4r07/gomi
$ brew install gomi

Binary only

Otherwise, download the binary from GitHub Releases and drop it in your $PATH.


Replace rm with gomi

Put something like this in your ~/.bashrc or ~/.zshrc:

alias rm="gomi"

This is recommended. By doing so, it is possible to prevent rm command from removing an important file.


gomi read the TOML configuration such as the following from the ~/.gomi/config.toml. In ignore_files, you can describe shell file name pattern that you do not want to add to history for restoration.

root = "~/.gomi"

# Interpret if name matches the shell file name pattern
ignore_files = [

gomi_size = 1000000000 # 1GB

Versus Other Trash Tools

  • andreafrancia/trash-cli

    Command line interface to the trashcan.

  • sindresorhus/trash

    Cross-platform command-line app for moving files and directories to the trash - A safer alternative to rm

🚯 Do not use litter, use gomi.


MIT © BABAROT (a.k.a. b4b4r07)