tg-z / web-clip

26 stars 5 forks source link

how to not rm yourself - sindre sorhus #1014

Open tg-z opened 4 years ago

tg-z commented 4 years ago

How not to rm yourself

The rm command is inherently dangerous and should not be used directly. It can at worst let you accidentally remove everything. Here's how you can protect you from yourself.

Use trash-cli

The trash-cli command-line app will move stuff to the trash instead of permanently deleting it:

$ npm install --global trash-cli
$ trash unicorn.png rainbow.png

Works on macOS, Linux, Windows. Requires Node.js.

Safeguard rm

Even though you don't use rm directly, external scripts most likely will. There are some things you can do to safeguard this: