2016-10-25 10:41:06 +00:00
* rip (Rm ImProved)
2016-10-04 11:55:38 +00:00
[[https://crates.io/crates/rm-improved ][https://img.shields.io/crates/v/rm-improved.svg ]]
2016-10-17 11:18:48 +00:00
[[https://travis-ci.org/nivekuil/rip ][https://travis-ci.org/nivekuil/rip.svg?branch=master ]]
2016-10-04 11:55:38 +00:00
2016-10-26 10:38:35 +00:00
=rip= is a command-line deletion tool focused on safety, ergonomics, and performance. It favors a simple interface, and does /not/ implement the xdg-trash spec or attempt to achieve the same goals.
2016-10-22 06:56:27 +00:00
2016-11-04 20:46:32 +00:00
Deleted files get sent to the graveyard (=/tmp/graveyard-$USER= by default, see [[https://github.com/nivekuil/rip#-notes ][notes ]] on changing this) under their absolute path, giving you a chance to recover them. No data is overwritten. If files that share the same path are deleted, they will be renamed as numbered backups.
2016-08-31 01:12:21 +00:00
2016-10-22 12:16:54 +00:00
=rip= is made for lazy people. If any part of the interface could be more intuitive, please open an issue or pull request.
2016-08-31 01:12:21 +00:00
2016-10-23 12:22:41 +00:00
** ⚰ Installation
2016-10-25 10:31:07 +00:00
Get a binary [[https://github.com/nivekuil/rip/releases ][release ]] (Linux x86_64, ARMv7 and macOS), untar it, and move it somewhere on your $PATH:
#+BEGIN_EXAMPLE
$ tar xvzf rip-*.tar.gz
$ mv rip /usr/local/bin
#+END_EXAMPLE
or build it with a nightly rustc:
#+BEGIN_EXAMPLE
$ cargo install rm-improved
#+END_EXAMPLE
2016-10-23 12:22:41 +00:00
** ⚰ Usage
2016-08-31 01:12:21 +00:00
#+BEGIN_EXAMPLE
USAGE:
2016-10-16 23:50:12 +00:00
rip [FLAGS] [OPTIONS] [TARGET]...
2016-08-31 01:12:21 +00:00
FLAGS:
2016-10-22 06:58:59 +00:00
-d, --decompose Permanently deletes (unlink) the entire graveyard
2016-09-04 14:01:00 +00:00
-h, --help Prints help information
2016-10-22 06:58:59 +00:00
-i, --inspect Prints some info about TARGET before prompting for action
-s, --seance Prints files that were sent under the current directory
2016-09-04 14:01:00 +00:00
-V, --version Prints version information
2016-08-31 01:12:21 +00:00
OPTIONS:
--graveyard <graveyard > Directory where deleted files go to rest
2016-10-26 10:30:05 +00:00
-u, --unbury <target > Undo the last removal by the current user, or specify some file(s) in the graveyard. Combine with -s to restore everything printed by -s.
2016-08-31 01:12:21 +00:00
ARGS:
2016-10-16 23:50:12 +00:00
<TARGET >... File or directory to remove
2016-08-31 01:12:21 +00:00
#+END_EXAMPLE
2016-10-23 12:16:34 +00:00
Basic usage -- easier than rm
2016-10-22 06:56:27 +00:00
#+BEGIN_EXAMPLE
2016-10-24 00:41:34 +00:00
$ rip dir1/ file1
#+END_EXAMPLE
Undo the last deletion
#+BEGIN_EXAMPLE
2016-10-26 10:30:05 +00:00
$ rip -u
2016-11-04 20:19:07 +00:00
Returned /tmp/graveyard-jack/home/jack/file1 to /home/jack/file1
2016-10-24 00:41:34 +00:00
#+END_EXAMPLE
Print some info (size and first few lines in a file, total size and first few files in a directory) about the target and then prompt for deletion
#+BEGIN_EXAMPLE
$ rip -i file1
dir1: file, 1337 bytes including:
> Position: Shooting Guard and Small Forward ▪ Shoots: Right
> 6-6, 185lb (198cm, 83kg)
Send file1 to the graveyard? (y/n) y
2016-10-22 06:56:27 +00:00
#+END_EXAMPLE
2016-10-23 12:16:34 +00:00
Print files that were deleted from under the current directory
2016-10-22 06:56:27 +00:00
#+BEGIN_EXAMPLE
$ rip -s
2016-11-04 20:19:07 +00:00
/tmp/graveyard-jack/home/jack/file1
/tmp/graveyard-jack/home/jack/dir1
2016-10-22 06:56:27 +00:00
#+END_EXAMPLE
2016-10-24 00:41:34 +00:00
Name conflicts are resolved
2016-10-22 06:56:27 +00:00
#+BEGIN_EXAMPLE
$ touch file1
$ rip file1
$ rip -s
2016-11-04 20:19:07 +00:00
/tmp/graveyard-jack/home/jack/dir1
/tmp/graveyard-jack/home/jack/file1
/tmp/graveyard-jack/home/jack/file1~1
2016-10-22 06:56:27 +00:00
#+END_EXAMPLE
2016-10-26 10:30:05 +00:00
-u also takes the path of a file in the graveyard
2016-10-22 06:56:27 +00:00
#+BEGIN_EXAMPLE
2016-11-04 20:19:07 +00:00
$ rip -u /tmp/graveyard-jack/home/jack/file1
Returned /tmp/graveyard-jack/home/jack/file1 to /home/jack/file1
2016-10-22 06:56:27 +00:00
#+END_EXAMPLE
2016-10-26 10:30:05 +00:00
Combine -u and -s to restore everything printed by -s
2016-10-22 06:56:27 +00:00
#+BEGIN_EXAMPLE
2016-10-26 10:30:05 +00:00
$ rip -su
2016-11-04 20:19:07 +00:00
Returned /tmp/graveyard-jack/home/jack/dir1 to /home/jack/dir1
Returned /tmp/graveyard-jack/home/jack/file1~1 to /home/jack/file1~1
2016-10-22 06:56:27 +00:00
#+END_EXAMPLE
2016-10-23 12:22:41 +00:00
** ⚰ Notes
2016-10-26 14:09:44 +00:00
- You probably shouldn't alias =rm= to =rip= . Unlearning muscle memory is hard, but it's harder to ensure that every =rm= you make (as different users, from different machines and application environments) is the aliased one.
2016-10-22 12:16:54 +00:00
- If you want to put the graveyard somewhere else (like =~/.local/share/Trash= ), you have two options, in order of precedence:
1. Alias =rip= to =rip --graveyard ~/.local/share/Trash=
2. Set the environment variable =$GRAVEYARD= to =~/.local/share/Trash= .
2016-10-23 12:16:34 +00:00
This can be a good idea because if the graveyard is mounted on an in-memory filesystem (as /tmp is in Arch Linux), deleting large files can quickly fill up your RAM. It's also much slower to move files across filesystems, although the delay should be minimal with an SSD.
2016-10-26 10:38:35 +00:00
- In general, a deletion followed by a =--unbury= should be idempotent.
2016-10-23 12:16:34 +00:00
- The deletion log is kept in =.record= , found in the top level of the graveyard.