gomi

I keep what you rm.

gomi is a trash can for the command line. Use it like rm. Nothing is gone until you empty it, and rm -b brings things back to where they were.

Throw a file in, then look inside the can.

Click a file to throw it out.
0

Look inside the can.

This is rm -b, drawn the way gomi draws it: under your prompt, with the file on the cursor previewed on the right. What you threw out above is in here too. Click the terminal and use the keys; enter restores, and a file from ~/work lands back on the desk.

~/work — zsh
click the screen to type
!Something has its name there now. gomi asks for a new name before restoring.
+Its directory is gone. gomi makes it again on the way back.

Your rm habits stay.

Put alias rm=gomi in your shell config. The flags you know keep their meaning, and the trash is the same XDG trash your desktop and trash-cli use. Linux, macOS and Windows.

rm file

Into the can, not into oblivion.

rm -rf dir/

Directories too, without a prompt.

rm -i *.log

Asks before each file.

gomi --prune=30d

Empties what is older than 30 days. --dry-run looks first.

Pick up a can.