rip - 間違った削除をしても大丈夫なrmコマンド代替
不要なファイルはさくっと削除したい、でも間違って削除した時には復帰できるようにしたい…人はそんな相反する願いを持つものです。そこでOSではゴミ箱を備えるようになり、間違った時にすぐに戻せるようにしています。 しかしrmコマンドは違います。男らしくファイルは完全に消えてしまいます。rmを使って間違えたことがあるという方はripを使いましょう。
ripの使い方
ripのヘルプです。使い方はrmと変わりません。
$ rip --help
rip 0.11.1
mail@nivekuil.com
Rm ImProved
Send files to the graveyard (/tmp/graveyard-$USER by default) instead of unlinking them.
USAGE:
rip [FLAGS] [OPTIONS] [TARGET]...
FLAGS:
-d, --decompose Permanently deletes (unlink) the entire graveyard
-h, --help Prints help information
-i, --inspect Prints some info about TARGET before prompting for action
-s, --seance Prints files that were sent under the current directory
-V, --version Prints version information
OPTIONS:
--graveyard <graveyard> Directory where deleted files go to rest
-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.
ARGS:
</target><target>... File or directory to remove
ファイルを削除して間違った、というときには -u でundoできます。
$ rip /Users/nakatsugawa/Downloads/Craft-2.6.2950.zip
$ rip -u
Returned /tmp/graveyard-nakatsugawa/Users/nakatsugawa/Downloads/Craft-2.6.2950.zip to /Users/nakatsugawa/Downloads/Craft-2.6.2950.zip
-sで復帰可能なファイルを一覧で確認できます。
$ rip -s
/tmp/graveyard-nakatsugawa/Users/nakatsugawa/Downloads/Craft-2.6.2950.zip
-dで完全に削除します。
$ rip -d
Really unlink the entire graveyard? (y/N) y
ripは一旦待避先として /tmp/graveyard-$USERNAME へファイルやディレクトリを移動します。同じ名前のファイルをripすると ~1 のような名前になります。誰もがやりがちなファイル削除ミスを防止するためにも普段からripを使うのはいかがでしょう。
ripはRust製のオープンソース・ソフトウェア(GPL v3)です。