News for hackers. Stuff that matters.
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by somanyquestions on Wednesday October 24, 2018 @10:43AM (#18292818)
yikes!

It's always been surprising to me that their isn't a built in "undo" to `rm`

e.g. why doesn't `rm` just move files to /tmp?

Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by michaelmrose on Wednesday October 24, 2018 @01:03PM (#18294251)
You can make a trash command if you want and a cron job to periodically remove everything over x days old.

The default rm doesn't do this because shell users are supposed to be able to figure out how not to delete things they want to keep.

Kind of like not pointing a gun at people who you don't want to kill.

The undo for rm is regular backups.

Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by drb91 on Wednesday October 24, 2018 @02:21PM (#18294986)
Journaling works well here too, but in my experience the interface sucks on every platform. Eg, it should be trivial to view recent unlinks. There’s simply more reason to invest in backup software, which has an excellent interface even if it is a “heavy” operation.
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by Skunkleton on Wednesday October 24, 2018 @03:34PM (#18295622)
That is not what journaling is for. Journaling is for maintaining filesystem consistency. If you want access to recently deleted files that is a different task.

On my system I have snapshots of my home directory created every 15 minutes. Not quite the same thing, but it also helps me when I have incorrectly modified a file.

Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by drb91 on Thursday October 25, 2018 @05:20PM (#18304678)
Well, it’s a loss for us all that the designers were not more imaginative.
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by clarry on Wednesday October 24, 2018 @11:03AM (#18293017)
> e.g. why doesn't `rm` just move files to /tmp?

And do what when tmp gets full and services & applications start crashing?

When someone implements that undo, someone's going to need to write a tool that really does remove files, really. Will the next guy wonder why really-rm doesn't have undo built in?

Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by diegoperini on Wednesday October 24, 2018 @01:13PM (#18294363)
What about undo that expires in 1 minutes? Gmail website does that for sent emails (for 5 seconds I guess).
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by hk__2 on Wednesday October 24, 2018 @01:39PM (#18294618)
> What about undo that expires in 1 minutes? Gmail website does that for sent emails (for 5 seconds I guess).

Same question as parent: "And do what when tmp gets full and services & applications start crashing?"

Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by kungtotte on Wednesday October 24, 2018 @11:55PM (#18298461)
You could do what is more or less an industry standard when it comes to this and warn the user that there's not enough room to allow an undo when deleting said file(s) and prompt if they want to delete it permanently instead.

It's not rocket surgery.

Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by jxy on Wednesday October 24, 2018 @02:11PM (#18294899)
I'm never that nervous when doing `rm -fr` on my Plan9 or FreeBSD or macOS systems, which all have frequent snapshots turned on.

We could all just work with WORM drives instead.

Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by Skunkleton on Wednesday October 24, 2018 @03:58PM (#18295823)
I am similarly not worried on my Linux system, which also has frequent snapshots turned on. Instead I worry about bugs in btrfs, but that is another story.
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by piano on Thursday October 25, 2018 @08:02AM (#18300231)
> It's always been surprising to me that their isn't a built in "undo" to `rm`

Have a look at either the `trash-cli` package by Andrea Francia.

Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by drb91 on Wednesday October 24, 2018 @02:20PM (#18294974)
Mildly related, I wish rm would check that you’re not unlinking the current directory. I’ve never wanted the behavior when I accidentally invoke it.
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by hyperpallium on Wednesday October 24, 2018 @01:12PM (#18294352)
alias rm to rm -i (always prompt)

I don't do this because my idiocy must be punished disproportionately. Also, you end up automatically pressing y enter.

Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by arminiusreturns on Wednesday October 24, 2018 @01:20PM (#18294419)
sysadmin here, yep, aliases are how I deal with dangerous commands as well.
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by michaelcampbell on Wednesday October 24, 2018 @08:08PM (#18297571)
And when you get used to your carefully curated crutches and have to work on someone else's machine, that's where the fun starts.

Aliases can be way more dangerous; think about what you're doing. This is what backups are for.

Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by arminiusreturns on Friday October 26, 2018 @02:25PM (#18311652)
This is true, which is why I dont use them much!
Re:Show HN: Ultimate Plumber – a tool for writing Linux pipe... by pbhjpbhj on Wednesday October 24, 2018 @11:53AM (#18293485)
You could easily make rm inactive (remove execute flag, move it, ...) and make rm an alias for send to trash (gvfs-trash, trash-cli, or whatever).