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
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.
- Easy to restore (thanks to
- Quick preview feature
- Customizes TOML format configuration file
- Interacts nicely with
- A single binary
- Cross-platform CLI app
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. 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.
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...
Remove! Throw away the trash
$ gomi files
Restore! Scavenge the trash
$ gomi -r
It is able to replace
gomi. However, on the characteristics of it, it dosen't have options such as
-i at all. The available option is
To actually delete rather than the trash:
$ gomi ~/.gomi/2015/05/01/gomi_file.13_55_01
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
|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 git.io/gomi | bash
If you want to go the Go way (install in GOPATH/bin) and just want the command:
$ go get -u github.com/b4b4r07/gomi/...
Mac OS X / Homebrew
If you're on OS X and want to use Homebrew:
$ brew tap b4b4r07/gomi $ brew install gomi
Otherwise, download the binary from GitHub Releases and drop it in your
Replace rm with gomi
Put something like this in your
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 = [ ".DS_Store", "*~", "unko", ] gomi_size = 1000000000 # 1GB
Versus Other Trash Tools
Command line interface to the freedesktop.org trashcan.
Cross-platform command-line app for moving files and directories to the trash - A safer alternative to