# 【Devil's Command】Accident prevention measures of "rm -rf /" [trash-cli]

The famous devil command rm -rf / in the engineer neighborhood

I often hear of failure stories that I've been doing with this command for a long time, but at last a familiar person has made it w

Therefore, we will consider measures to prevent recurrence.

## At first

この記事は、2014年の覚書をもとに書いています。 やっちまった 家のサーバの調子がいまいち。立ち上げた時にへんな具合になるので、とりあえず日記等々いろいろなものをバックアップしておこうと思って、tarで固めようとした。で、ta...

## rm -rf /

Simply put, the command to delete everything.

If you write each one super easily, it looks like this.

【 rm 】コマンド――ファイルを削除する

## trash-cli

GitHub - andreafrancia/trash-cli: Command line interface to the freedesktop.org trashcan.
Command line interface to the freedesktop.org trashcan. - GitHub - andreafrancia/trash-cli: Command line interface to the freedesktop.org trashcan.

I found something called trash-cli. When introduced, the following command is added:

• trash-put – Go to Recycle Bin
• trash-list – list of recycle bins
• trash-restore – restore from recycle bin
• trash-empty – empty the recycle bin
• trash-rm – delete individual files from recycle bin

By linking the trash-put in this with the rm command, deleted files and directories will once enter a dedicated recycle bin. (Can be restored from there arbitrarily)

### Install

The environment is Mac. It seems to be available in other environments, but I haven't tried it.

As of October 23, 2020, it was v0.17.1.

$alias rm alias rm='trash-put' ## I'll test it. Try deleting it and try restoring it. # Make a suitable file$ touch test.txt
# Delete it
$rm test.txt # Check the contents of the recycle bin$ trash-list
What file to restore[0..0] : 0
Since it seems that file recovery is not university, it may be difficult to restore when you really rm -rf / w