Hacker News new | past | comments | ask | show | jobs | submit login

Next post by author will be how one should wait before teaching the rm command to kids, and to always have a backup of all valuable files.



Are people still using raw "rm" and not aliasing to "trash-put"?

People should start making their shells act like in the 2000's and not 1990.

I only use raw "rm" when I need to delete a large folder that should not go in the trash bin.

In fact distros should start caring for user friendliness and even ask to do that on installation.

A system with no trash bin is what, before Windows 95?


> Are people still using raw "rm" and not aliasing to "trash-put"?

as a regular user of rm for decades without any issue whatsoever this reads like parody.

I understand it probably isn't, and I understand the logic behind the design choices that are prevalent in a modern OS..

but some of us just want the machine to do what it's told the first time, and we're competent and confident enough with our holstered foot-guns that we're not a major threat to any system that is being administrated properly.

>In fact distros should start caring for user friendliness and even ask to do that on installation.

I felt a great disturbance in the Force, as if millions of scripts suddenly cried out in terror and were suddenly silenced. I fear something terrible has happened.


> as a regular user of rm for decades without any issue whatsoever this reads like parody.

Sure, for someone riding a horse for decades, a bicycle may look like a parody but people should look for more convenient methods.

> we're competent and confident enough with our holstered foot-guns that we're not a major threat to any system that is being administrated properly.

This is more like a parody that you should realize how many people are losing data over simple wrong "rm" everyday as apparently average people aren't as competent as you're with decades of experience.

Desktop Linux also has a trash bin like anyone would expect. Not sure why this is not the case on the command line.

Yes, aliasing rm to trash-put may screw bunch of scripts but that doesn't mean people should find out about trash-cli after they've lost data. Smart scripts should not rely on aliases but use a clean environment or specify a full path to a command as well.

It could act as trash-put when used interactively or how come rm itself can't evolve over POSIX when rm is one of the easiest way to screw yourself with no confirmation by default.


I've never once used `trash-put`, but thanks for introducing it to me. Personally I've never found the concept of a temporary storage area for files I want to delete to be helpful. Even on Windows I would Shift-Delete files to skip the step of having to review it later. And in most cases I would just empty the Recycle Bin without checking.

The thing is that many Linux commands can wreck your system if you're not careful: a wrong `dd` or `mkfs`, removing a core package and its dependencies, a wrong change in `/boot`, etc.

I've definitely lost work because of this, but it always served as a learning experience, and I was more careful next time. I don't think I'd want to use a system with training wheels, not even when I was learning. The whole idea of Unix is giving full control to the user, and respecting them enough to allow them to make mistakes. If I didn't want that I'd be using a more restrictive OS.

BTW, a good middle ground between raw `rm` and `trash-put` is `alias rm='rm -i'`. This way you can confirm deletions or pass `-f` to force it.


> `alias rm='rm -i'`

Done that 15 years ago.

Ended up using -f because the confirmation got annoying fast.

Landed onto using trash-cli and never had to bother anything when rm'ing.

You can add 'trash-empty 30' in daily cron to delete files older than 30 days in the trash.


> this reads like parody

people try to coin terms and initiate trends all the time. it's no 'thats so fetch' but its not that bad. I'd never use it personally and have never heard of this type of lunacy but to each their own.


> Windows 95

Deletion confirmations are more important in GUI systems like Window's file explorer, where accidentally deleting a selected file would otherwise be a single mistaken keypress away. The delete key is easy to accidentally press. Your cat could even do it for you. Using rm requires a lot more effort, so I don't find a confirmation necessary.


Ever run 'rm' from shell history with Ctrl-r with a quick muscle memory and next moment the file was gone?

A cat needs to step on up arrow and enter to repeat a command as well.


Honestly I can't say I have. I usually keep removals and other hazardous commands out of my shell history by prepending them with a space character. And, if the command is coming out of my shell history, probably the file is already gone anyway (I also never use rm with relative paths, it just seems like a bad idea. Entering the full path is part of my confirmation process.)

But supposing all the stars aligned against me and my cat re-ran a removal from my shell history that actually referred to a file that existed still, I think that's a significantly less likely scenario than accidentally pressing delete in a GUI file explorer. Selecting files in a file explorer is a very common operation. And something is selected, the confirmations are the only thing standing between you and a single keypress disaster.

You know what commands scares me more than rm? cp and mv. Both of those can overwrite files, effectively deleting them. When I use rm at least my mind is already on the topic of file removal. (And yes, I know about -i, but who has time for that... I tried using aliases with -i once and disabled it the first time it inconvenienced me. Besides, I don't want to rely on a crutch that might not be there when I really need it.)

I've mostly moved away from all of this anyway, and primarily use dired and ranger.


I think even better is alaising del to trash-put and rm to rm -i. This trains me to use del normally, so if I'm on a system that doesn't have my alias I won't accidently really delete something.

It saves me, usually in minor ways, a few times a year.


I do one step further and just don't use rm much at all. If I have a terminal open, it's probably because I got it from the right click menu in the file manager, and I can just click over probably faster than I could rm, and I don't really care to practice for hours to maybe get fast enough to save a few seconds.

If I were to alias rm to something safer, I would probably get used to it, and over time start being less careful on the rare occasions I do use it.

Then I'd SSH into some system that didn't have the alias, and screw myself over.

rm should ideally have trashed stuff instead from the start, but since it doesn't, I think it's best to forevermore treat it as a dangerous command, unless all major distros switch.


I use raw rm. I just double check what the name of the file is before pressing enter. I've deleted something I shouldn't have maybe once or twice in the past ten years.

When I'm about to delete something with wildcard expansion, I'll first `ls` the wildcard expansion and glance over the results to make sure I'm not deleting anything I don't want to delete.


Those are all jokes asking for trouble.

Glad you've diligently followed that rule for over 10 years but think of average users.

It's also very possible that you actually want the file back later even though you thought you didn't need it then.


Personally I trash files much more frequently by accidentally redirecting output into them than by rm'ing them.

The real saviour is git.


I have never heard of the trash command. I learned unix from stackoverflow etc. and this was never mentioned as the first option eventhough it makes a lot of sense now that i read it


Indeed I was expecting things to go wrong as soon as the rm command was introduced.


Haha I hope it won't be, I haven't shown him `cd` yet.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: