Tired as fuck

>tired as fuck
>forget which directory I'm in
>rm -rf *
>delete home directory
Well, had to happen at some point I guess.

>thingsthatdidnthappen.bat

>thingsthatdidnthappen
say that to my empty home directory

How do you forget which directory you are on
It's always right there on the prompt

Every time I think about reinstalling Linux I read one of these stories. Thank you.

Happens to me too often. One of these days I'm going to alias rm to mv and move whatever i was deleting to a recycle bin folder.

by working half alseep

>not aliasing 'rm -rf'='rm -rfi' or some such
also ur dumb rofl

I always try to use absolute paths for any 'destructive' operations. Moves or deletes, mostly.
Doesn't neccessitate avoiding the use of wildcards, neccessarily, just fully qualify them.
rm -rf /home/user/directory/*
mv relative.file /home/user/directory/

Also not a bad idea to do for things like setting permissions, owners, groups, etc.

Sucks about your home folder. I guess you'll be careful in the future huh. I hope you had all your config mirrored in a git repo or something like a smart person.

Many years ago, before I knew how to write proper bach scripts, or use backups, or use version control, or otherwise do anything right at all, I deleted an entire website.

The backup zips were in the same folder as the webroot.

I was doing this:
rm -rf website.1.tgz [Hit Enter]
[Up, Delete x 5, Tab, Enter]
etc
then I got this in my buffer
rm -rf website.prod
[Hit Enter, Say Oops]

The boss, who wrote the website btw, turns to me and goes "WHAT DO YOU MEAN OOPS"

I switched off the box pronto, mounted in in a spare drive bay on another host, then dd'ed it's contents through string and regexp to find HTML like pages.

Eventually sent the boss a huge jigsaw puzzle in 4k blocks to sort out.

Took him two weeks to put that back together.

is there a difference between
>rm -rf *
and
>rm -rf .

I've done this before too.

Why isn't there a confirmation prompt when that is run?

Just restore your latest btrfs snapshot. :^)

>back in the really early days of Linux, kernel 0.99-something
>had to be root a lot to fix things
>friend comes by, sits at computer, tries something, then wants to delete his shit
>rm -rf *
>he's root, cwd is /
>"Why does that take so long?"
>"Oh shit."
>Back then you still had to feed the computer some 30 floppy disks to install Linux, which took several hours.

And this is why you don't take Linux as a your primary home OS.
Seriously, shit like this is retarded. Yes, yes, I know Linux is all about personal choice, but even a fucking double check before you delete a damn directory would be bloody nice.

Because you are using the -f FORCE option. for fucks sake

did you get a promotion

* is a wildcard.

Things are fine the way they are now. What linix IS REALLY LACKI is a simple UNDO command. It would the whole thing so much more user friendly. People would work faster and be less afraid to make mistakes.

WTF I hate Linux now!

nice b8

there is no undo with rm

I hope you had backups like any smart man.
Every time you use any destructive command you double check. I don't care how tired you are.
No dd without double check.
No rm -rf without double check.

-FFFFFFFFF

RTFM FAGGOT

Holy fuck, is it autistic in here.

Several anons are right. You shouldn't have used rm -rf, ESPECIALLY without knowing what directory you were in.

This is why I just do rm -rv. That way, I can at least see the fucking list fly by, and if I fucked up, CTRL + C. Of course, I'm not stupid enough to not run ls first.

>there is no undo with rm

There should be one, it's technically possible, so why not.

I've lost shit by moving stuff to a drive I didn't have write access on.. no warning or anything, after the wire failed it proceeded to delete the original, used mv.

I've used testdisk to recover terabytes of accidentally deleted files, as well as files from deleted filesystems.

It's on my list of software I don't use often, but is too valuable to forget.

This is why you always cp + rm when working across filesystems. mv literally acts like cp [path] && rm [path] when working across filesystems, so why not just type both? You can also use different options for each.

Fucking DOS had an undelete command. But I guess having basic, sensible security measures in Linux land is not considered very manly.

>forget what directly i am in
>its literally in the prompt next to where you are typing
>not looking where you are typing
>probably some keyboard pecker

Oh, they're there. These idiots just bypassed it.

Also, the testdisk allows for browsing and reconstruction of filesystems and files. Does the DOS (assuming you mean MS-DOS) undelete command do that?

No I had to actually quit and go contract.

Those retards told their most important client to gfts when asked to put on more headcount.

Of course they got outcucked by ThoughtWerks.

Microsoft Windows 10 doesn't have this problem.

>g to alias rm to mv and move whatever i was deleting to a recycle bin folder.
Not doing this is actually the problem with rm. It's beyond me why there's not standard trash directory on UNIX or Linux.

>-f
Yeah, and does it ask for confirmation without the -f?

B-b-b-but what if you go
rm * -rf
or some other argument variation?

alias rm="rm -iv"

That's what you get for pretending to be a leet haxor by using a command line.

yes

> You don't understand UNIX
The computer does what you tell it too.
vs
The computer does what you think you told it too.
vs (nowadays)
The computer does stuff and tells you that you wanted it to do it/doesn't even bother telling you it did it.

What distro are you using? I know for a fact this is impossible on a few of them.

Somebody seriously using Linux as a primary home OS wouldn't be autistically manipulating their filesystem through the command line, but rather with a file manager. They'd never encounter such accidental retardation

I manipulate my Linux file system through the command line as it's much faster than clicking my way around in a browser.

what the fuck

try it on ubuntu. It wont work

>he hasn't created a file called "-i" in his home directory to protect himself from that problem
You kind of deserve this. Consider this to be your lesson, and read "UNIX-HATERS Handbook."

>polski
gtfo, Janusz

my advice for when this happens:
DO NOT EVEN TOUCH THE DRIVE AFTER RUNNING rm -rf. DON'T WRITE ANYTHING TO IT. kill all the programs writing to the partition and unmount the drive as fast as you can.

there is extundelete. it's not easy to use... but it could help. there are lots, LOTS of forensics/data recovery tools
if you need to mount the partition, mount it as read-only. to recover the data, make a disk image and run extundelete on that, if possible. otherwise, make sure you won't write anything to it.

it's not. he's saying he deleted everything in his home folder, not in /. also, you still can run rm -rf /* in ubuntu

rm in GNU coreutils has the --no-preserve-root flag, so you can even try to delete /

Can't help stupid I guess

Is there some way to implement OS-level access control that bars even root from using "rm -rf" in certain directories?

Maybe make it so you need to enter a password to do it
yes, I know it sort of kills the point of -f, but whatever

You realise that the -rf argument forces removal just like this does in Windows, right?

del /q /f [path]

In a command line there's always higher risk when doing stuff like this.

sudo apt-get install trash-cli

alias rm='trash-put'

their github tells you not to do this

Your prompt should display working directory if you were smart.

If you don't have control over your OS you can't fuck it up

>linux

rm -rf *

OP wasn't supposed to do this either, but here we are

extundelete --restore-all /dev/sd??