Linux Horror Stories and Protection Spells (Volume I) (2021)

29 pointsposted 3 hours ago
by marcodiego

9 Comments

prmoustache

an hour ago

Relying on aliases is the worse solution in my opinion. If it is protecting you too much, you will forget the risk and once for some reason you end up on a shell with a different profile you will forget about it and run a risky command.

tester457

2 hours ago

Instead of `alias rm="rm –I"` for the confirmation dialog before removing a file, I prefer to use trash-cli[0] since I can restore trashed files.

However, I haven't found a similar solution that works on Termux.

[0] https://github.com/andreafrancia/trash-cli

abnry

2 hours ago

I do the same. My alias for rm just echos "use trash" so I don't replace its function, just disable it.

When I really need to use rm I type /bin/rm.

9dev

2 hours ago

Bash also allows you to use \rm to override the alias. Comes in helpful at times.

shagie

an hour ago

On a per directory basis...

     % touch -- -i
     % touch foo
     % touch bar
     % rm *
    zsh: sure you want to delete all 3 files in /Users/shagie/test [yn]? y
    remove bar? y
    remove foo? y
     % ls 
    -i
     %

Filligree

3 hours ago

You should, of course, have backups. And one form of backups which you should have are point-in-time snapshots; every ten minutes sounds good.

I’ve lost count of the number of times I’ve deleted something I shouldn’t, but it’s never a big deal.

Its_Padar

2 hours ago

This is from 2021¹, so it should probably have a (2021)

¹See bottom of article under who the author is