zsh-gomi
is a simple trash tool that works on CLI.
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).
DEMO:
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.
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.
$ gomi --help
usage: gomi [OPTIONS] files...
gomi delete files like rm command
but unlike rm, files are moved to trash box
options:
-h, --help show this help message
-r, --restore restore discarded files
-s, --system remove files to system trash box
Basic usage is...
-
Remove! Throw away the trash 📦
$ gomi files
-
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 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
.
These are extended keybinds below.
Keys | Actions |
---|---|
Enter | Restore the file under the cursor or selected files |
C-v | Quick view (with pygmentize if available) |
C-x(C-x) | Remove selected files really with rm command |
And about more keybinds see man fzf
.
Using zplug
# Install zsh-gomi(If fzf is already installed)
zplug "b4b4r07/zsh-gomi", if:"which fzf"
zsh-gomi requires fzf to work properly. If you don't have fzf in the $PATH
, you should install fzf with zsh-gomi.
# Install zsh-gomi with fzf
zplug "junegunn/fzf-bin", \
as:command, \
from:gh-r, \
rename-to:"fzf", \
frozen:1
zplug "b4b4r07/zsh-gomi", \
as:command, \
use:bin/gomi, \
on:junegunn/fzf-bin
-
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
rm
🚯 Do not use litter, use zsh-gomi.