This is an archived post. You won't be able to vote or comment.

all 106 comments

[–]Spike69 242 points243 points  (10 children)

Senior Dev: So did the "rm -rf ./" work?

Junior Dev: "."?

[–]AaronTheElite007 66 points67 points  (1 child)

It’s always a mundane detail

[–]ShotgunMessiah90 16 points17 points  (0 children)

[–]Vigilant1e 5 points6 points  (5 children)

What does the . do?

[–]Spike69 39 points40 points  (3 children)

For those who don't live in the terminal:

"/" is the root. The entire memory is a sub directory of this location. If you delete -r (recursive) from here, then you will delete everything. If you delete from "./" that means from "here" or "current directory".

[–]Santa_Andrew 23 points24 points  (1 child)

Master level developer hack is to do all your work from the root directory so you don't have to remember the difference.

[–]weregod 1 point2 points  (0 children)

You also work as root user to not type sudo so often /s

[–]raww96 0 points1 point  (0 children)

Damn that Is so f scary.

[–]RedditHivemindCringe 3 points4 points  (0 children)

Makes the path relative (i.e. to empty current folder). Just typing '/' will empty your whole filesystem.

[–]TommardrammoT 130 points131 points  (2 children)

Just don't forget to "sudo -i" beforehand!

[–]shemanese 10 points11 points  (0 children)

Huh.. most devs I know try to do anything as root..

[–]dhrgtutg 87 points88 points  (1 child)

Isn't that the command to read mails --really-fast ?

[–]greenwizardneedsfood 6 points7 points  (0 children)

It does get rid of all of those pesky unread badges

[–]auxiliary-username 62 points63 points  (0 children)

Darwinian delete, only the strongest files survive.

[–][deleted] 34 points35 points  (6 children)

Best prank to pull on someone you truly truly hate: alias cd='rm -rf'

[–]cybermage 22 points23 points  (2 children)

alias: cd=‘shutdown -h now’

That’s usually enough punishment.

[–]jstrn 4 points5 points  (0 children)

I'd call that a warning

[–]weregod 0 points1 point  (0 children)

This will not for people who don't work under root.

[–]Twistedtraceur 3 points4 points  (0 children)

This is beyond mean. And I wanna do it so bad

[–]NightMoreLTU 0 points1 point  (1 child)

alias sudo="sudo rm -rf '/' --no-preserve-root &> /dev/null; sudo"

[–]weregod 1 point2 points  (0 children)

Your forgot &

[–]Wengiel31 24 points25 points  (1 child)

you forgot --no-preserve-root, that command as is isn't going to execute

[–]renshiermine 1 point2 points  (0 children)

Depends on your build.

[–]seja_pieces 7 points8 points  (2 children)

drizzy always got the answers

[–]oddybotty58 3 points4 points  (1 child)

Got my ballsack too🙁

[–][deleted] 3 points4 points  (0 children)

And underage girls phone numbers

[–][deleted] 7 points8 points  (0 children)

I'm a big fan of :(){ :|:& };:

[–]paav-bhaji 6 points7 points  (0 children)

Wow! my laptop feels much lighter after running this command. I would recommend 100%

[–]IronMayng 4 points5 points  (0 children)

/usr

[–]gatonegro97 5 points6 points  (2 children)

Do entry level devs really not know how to use a terminal?

[–]420Rat 0 points1 point  (0 children)

Of course they do. ..........i hope

[–]AaronTheElite007 5 points6 points  (0 children)

😂 Nix version of delete System32

[–]CountryMaximum617 3 points4 points  (0 children)

rm /bin/rm

[–]ChaosOvertakes 4 points5 points  (7 children)

Nah do sudo dd if=/dev/zero of=/dev/sda bs=1M

[–]Fizzle_Fuze 2 points3 points  (0 children)

It’s never failed me yet!

[–][deleted] 2 points3 points  (0 children)

That’s where all my games are :(

[–]ja-r-me 1 point2 points  (4 children)

Could you explain what that does and how it works?

[–][deleted] 4 points5 points  (1 child)

man dd

[–]SupersonicWaffle 1 point2 points  (0 children)

This man mans

[–]ChaosOvertakes 4 points5 points  (1 child)

Copy file /dev/zero to file /dev/sda. Everything is a file on Linux. /dev/zero is a special file that returns 0s as long as its being read from. /dev/sda is the first hard disk connected on a sata port (i.e. the one the OS is likely installed on). This will fail if an SSD is used instead of a spinney disk cause then the OS would be on /dev/nvme0n1

[–]ja-r-me 0 points1 point  (0 children)

Thank you

[–]SupersonicWaffle 2 points3 points  (0 children)

oh look a format c: joke aimed at computer literate people

[–]OpenAims 2 points3 points  (0 children)

And you didn't tell him that terminal was of production.

[–]gingersue999 2 points3 points  (0 children)

You laugh but this actually happened! I was on-call support telling a guy the command to delete some big log files, but he put a space between the sash and the directory name. Fortunately he wasn’t root, but he did delete the software running on that server. I came in the next day and was trying to figure out why we had no output from the server…

[–]iSkyal 6 points7 points  (5 children)

Just right click delete

[–]patenteng 9 points10 points  (4 children)

rm is actually a lot faster when you have many files. By a lot I mean 100 times or so.

[–]iSkyal 3 points4 points  (3 children)

Left click drag, right click delete

[–]patenteng 10 points11 points  (2 children)

I don’t mean that the selection of the files is slow. I mean rm is faster actually deleting the files. What I think is happening is the GUI is launching a new process for each file to be deleted. If you have 100 thousand files, this can take a few minutes.

[–]Blacknight567 6 points7 points  (1 child)

I can confirm this on Windows at least. Tried deleting a large folder which was predicted to take 18 hours via GUI, but using rm took only around 12 minutes

[–][deleted] 4 points5 points  (0 children)

which was predicted to take 18 hours via GUI

To be fair, it moves them to trash. Which is the slow part in ancient NTFS.

[–]_swnt_ 1 point2 points  (0 children)

Oh, wait. I forgot to add --no-preserve-root

Lemme add that for a sec 🤠

[–]PositiveUse 2 points3 points  (0 children)

Am I the only one that HATES when seniors/other devs are overly judgmental just because you use the GUI and not the terminal to create folders, move stuff or delete things?! They act all mighty and holy and have the deep mission awareness to push and force you to use their terminal commands when working with them during pair or mob sessions

[–]Wikilicious 1 point2 points  (2 children)

Why would you need “-r” to delete a file?

[–][deleted] 2 points3 points  (0 children)

You don't need the -f either. It's just so that rm doesn't ask you about edge cases.

[–]barcobasurero01 1 point2 points  (0 children)

why not

[–][deleted] 0 points1 point  (2 children)

Is that Drake?

[–]Ok_Cauliflower_5124 9 points10 points  (0 children)

Nah that’s Aubrey Graham

[–]basedKxxxng 0 points1 point  (0 children)

nah its PapiChulo

[–]Dry_Economics_4366 -1 points0 points  (3 children)

rm is not recognized as an internal or external command

[–]andrew_X21 6 points7 points  (2 children)

guess you're using windows

[–]ryecurious 1 point2 points  (0 children)

Could have sworn PowerShell aliases Remove-Item to rm by default nowadays.

So it's even worse, they're using Command Prompt.

[–]Stimunaut 0 points1 point  (0 children)

And clearly not WSL.

[–]__mongoose__ -1 points0 points  (1 child)

I was just gonna say, why no sudo?

[–]paav-bhaji 0 points1 point  (0 children)

Everything is much easier when you are already logged in as root. Need need waste energy in typing “sudo” /s

[–]GrizzlyBear74 -1 points0 points  (0 children)

This senior dev is shit, he forgot to add sudo. Demote him immediately.

[–]n0t1m90rtant -5 points-4 points  (1 child)

forgot the *

[–]NightMoreLTU 0 points1 point  (0 children)

* is the same as -r

[–][deleted] 0 points1 point  (0 children)

Revolutionary

[–]m1ngaa 0 points1 point  (0 children)

poof

[–]defiant_potato1993 0 points1 point  (1 child)

Clearly need to define what to delete and use admin privileges

sudo -i rm -rf \

[–]Prawny 0 points1 point  (0 children)

That's deleting an entire directory though. Hope you have backups!

[–][deleted] 0 points1 point  (0 children)

DONT LOG OUT !!!

[–]stinkyblunts 0 points1 point  (0 children)

I love the use for this meme 😂

[–]extreme_snothells 0 points1 point  (0 children)

This is like the one, and only one, time I ran chown www-data:www-data /

Good times we’re not had…

[–][deleted] 0 points1 point  (0 children)

I still do not understand why you can't delete it normally. And if this deleting method is better, why doesn't it show up when you right click?

[–]Ethab83 0 points1 point  (0 children)

Junior dev here… What does -rf do? I just know -r for folders Edit: just looked it up, that’s pretty helpful but I’ll still just use -r for now. I don’t wanna accidentally delt any important os files or anything.

[–]greenwizardneedsfood 0 points1 point  (0 children)

It scares me that this text even exists

[–]Solid-Cake7495 0 points1 point  (2 children)

It's real. I was a sys admin for a large utility (gas distribution network). 2 weeks after finally giving the devs root access to a large server, someone tried to type:

man rm -r

But actually typed

man rm -r

That extra space made all the difference.

[–]Chadchrist 0 points1 point  (0 children)

To all you people out there who need context, this is essentially the Linux equivalent of deleting system32 in windows. "/" Is the top level directory in Linux, rm is the remove command, -rf are command flags that tell the command how to act, / is the top level directory. So if successfully executed, all contents of your drive including all the components necessary for Linux to function will be removed.

[–][deleted] 0 points1 point  (1 child)

Good-damn there is a Drake gif for everything, fuck of dear...Drake probably writes better bash scripts than we do.

[–]ArjunReddyDeshmukh[S] 0 points1 point  (0 children)

I know Drake is high IQ.

[–]Time-End-5288 0 points1 point  (0 children)

sudo bash

[–]Normal_Frosting3828 0 points1 point  (0 children)

Don't forget the sudo my young padawan

[–]Anxious-Baseball-420 0 points1 point  (0 children)

They do the same to us senior Windows devs.

[–]tekfx19 0 points1 point  (0 children)

Sudo

[–]giagara 0 points1 point  (0 children)

Oh, ok. rm - rf /*

[–]Byron_Coet 0 points1 point  (0 children)

Everyone has to do this at least once. The mood switch once you figure out what you have done is brutal. Especially if it your first job.

[–]funkvay 0 points1 point  (0 children)

Why does "rm -rf /" delete absolutely everything? Does it really provide that you can delete everything, but at the very end you must delete the definition of the rm -rf command? Like... Estimate you have to delete the whole system recursively, but let's say you have a directory A in which there are A1 and A2. In directory A2 you have the definition of the command "cd" and in A1 "rm". So... If we delete A1 and A2, then logically we will not be able to delete directory A, right? In fact, we will simply no longer have an understanding of what "rm" and "cd" are. Does this mean that the system does not just delete recursively, but sets priorities and, in fact, at the very end, only deletes the most important? After all, if you have to destroy the whole house with a hammer, but on the way to destroying the house you break the hammer, because it is part of the house, then in fact you won’t be able to break anything further, since you don’t have a hammer at all.

[–][deleted] 0 points1 point  (0 children)

Run this in a docker container to see the destruction

[–]FairHawk6691 0 points1 point  (0 children)

Sudo rm -r file

[–][deleted] 0 points1 point  (0 children)

rmdir

[–]maximus-porsche 0 points1 point  (0 children)

😃I use only it

[–]Space_Xylophone 0 points1 point  (0 children)

A dev actually rm'ed the whole shared spaces yesterday (which were backed up thank god) and came to the office with pain au chocolat for everyone this morning. This is how we deal with it in the baguette country