Welcome to Incremental Social! Learn more about this project here!
Check out lemmyverse to find more communities to join from here!

bort ,

the linux-file-deletion is used as a example for good software design. It has a very simple interface with little room for error while doing exactly what the caller intended.

In John Ousterhout's "software design philosophy" a chapter is called "define errors out of existence". In windows "delete" is defined as "the file is gone from the HDD". So it must wait for all processes to release that file. In Linux "unlink" is defined as "the file can't be accessed anymore". So the file is gone from the filesystem immediately and existing file-handles from other processes will life on.

The trade-off here is: "more errors for the caller of delete" vs "more errors due to filehandles to dead files". And as it turns out, the former creates issues for both developers and for users, while the later creates virtually no errors in practice.

lemmyvore ,

doing exactly what the caller intended.

No, no. Exactly what the user told it to do. Not what they intended. There's a difference.

hstde ,

Exactly type rm -rf / instead of rm -rf ./ and you ducked up. Well you messed up a long time ago by having privileges to delete everything, but then again, you are human, some mistakes will be made.

taladar ,

Deleting the current directory via ./ seems contrived since you would just use . or more likely the directory name from outside the directory. What does happen is rm -rf ${FOO}/ while ${FOO} is an empty string.

NeatNit ,

Even so, . and / are right next to each other so it's a likely typo. You might press enter before you catch it.

0x4E4F OP ,
@0x4E4F@sh.itjust.works avatar

The double check before you rm things 🤷.

reinei ,

${Insert meme of qwertz ganz not having that problem here}

PrettyFlyForAFatGuy ,

yup, did that one on a server at work. had to go cap in hand to my manager to get him to fix it

qjkxbmwvz ,

Not sure if you're referencing the Steam incident, but Steam did exactly that: https://www.theregister.com/2015/01/17/scary_code_of_the_week_steam_cleans_linux_pcs/

Technofrood ,

Don't modern versions of rm block calling on / unless you pass a separate flag?

Ziglin ,

Yup I think it's --preserve-root

Semi_Hemi_Demigod ,
@Semi_Hemi_Demigod@lemmy.world avatar

Machines will always do what you tell them to do, as long as you do what they say.

Sonotsugipaa ,
@Sonotsugipaa@lemmy.dbzer0.com avatar
hDGGgrLpg8nEucjxWnJz ,

What do they say?

lurker2718 ,

Yes, the file itself (so the data and inode) is not gone as long as the handles live on. Only the reference is gone. You canstill recover the file.
https://superuser.com/questions/283102/how-to-recover-deleted-file-if-it-is-still-opened-by-some-process#600743

0x4E4F OP ,
@0x4E4F@sh.itjust.works avatar

The trade-off here is: "more errors for the caller of delete" vs "more errors due to filehandles to dead files". And as it turns out, the former creates issues for both developers and for users, while the later creates virtually no errors in practice.

Tell that to my dded porn collection.

RealFknNito ,
@RealFknNito@lemmy.world avatar

I like the windows delete philosophy of asking me before I delete something.

I fucking hate the windows delete philosophy of telling me I don't have access after I said yes.

I'm this close to daily driving as Sadmin

Agility0971 ,
@Agility0971@lemmy.world avatar

Better would be to delete without confirmation but being able to quickly reverse it with Ctrl+Z

0x4E4F OP ,
@0x4E4F@sh.itjust.works avatar

Siebel admin 🤨?

RealFknNito ,
@RealFknNito@lemmy.world avatar

Sad man 😔

Koof_on_the_Roof ,

One drive has a trash for the trash. I’m still not convinced those files are gone after the 2nd empty, I think they just don’t show the other trash cans

LostXOR ,

It's trash cans all the way down.

possiblylinux127 ,
@possiblylinux127@lemmy.zip avatar

The cloud is just someone else's trash can

BlackRoseAmongThorns ,

You know what they say, one man's trash...

possiblylinux127 ,
@possiblylinux127@lemmy.zip avatar

Is another ones treature

BlackRoseAmongThorns ,

Is another's CLOUD ☝️🤓

Ophioparma ,

That's because our all file systems are god's trash can.

Swarfega ,

Outlook on Exchange is like this. You can delete stuff to the Deleted Items directory. If you delete it from there it goes into another area called 'Recover deleted items'.

user224 ,
@user224@lemmy.sdf.org avatar

GUI file managers generally have "Trash" feature as well.

Ziglin ,

They usually support one but it is generally not provided by the file manager it's self. This means that assuming that the file managers use the same trash system you can trash a file on one recover it another.

flambonkscious ,

The windows shell has really gone downhill in recent years, with spontaneous file locks and random hangs

It's always the AV...

avidamoeba ,
@avidamoeba@lemmy.ca avatar

I'm so annoyed when I tell rm to delete a terabyte of data and it's nowhere near instant. I'd have probably gone insane if I was using Windows.

0x4E4F OP ,
@0x4E4F@sh.itjust.works avatar

1TB for Windows... depends on file size, but let's presume you have 1TB of Word documents... just hit Enter and go watch the Matrix trilogy.

Couldbealeotard ,
@Couldbealeotard@lemmy.world avatar

"what are you trying to tell me? I'll be able to select 'yes' when it asks me if I'm sure I want to delete?"

"No, Neo. I'm saying when you switch to Linux you won't have to."

Ziglin ,

You just need to ask permission.

0x4E4F OP ,
@0x4E4F@sh.itjust.works avatar

Oh man, that was great, brilliant! 👍

Andrew15_5 ,
@Andrew15_5@mander.xyz avatar

Akchooly, what you're referring to as terabyte (TB) is called tebibyte (TiB), because window$ suck and JADEC made everyone believe that binary units are metric units, which is stupid. But we have the savior IEC which KDE is using in all of their software and I respect that.

https://en.m.wikipedia.org/wiki/Binary_prefix

don ,

Left side: I regularly go bowling with the demon core

Right side: I have read the demon core’s wiki 314 times

0x4E4F OP ,
@0x4E4F@sh.itjust.works avatar

314 🤔... like as in Pi*100?

don ,

Mere coincidence

0x4E4F OP ,
@0x4E4F@sh.itjust.works avatar

There is no such thing as coincidence.

Gets down and his knees and starts bowing to the chosen one

CriticalMiss ,

I never deleted my root system with rm but I did dd go sda instead of sdb and ended up losing my data.

Rin ,

Holy shit, me too. 6TiB poof

0x4E4F OP ,
@0x4E4F@sh.itjust.works avatar

With great power comes great responsibility. Do check twice what you write.

Jokes aside, it has happened to almost everyone... and then you learn to QUADRUPLE CHECK dd commands.

vox ,
@vox@sopuli.xyz avatar

or just don't attach any drives except the main one to your system. ever.

0x4E4F OP ,
@0x4E4F@sh.itjust.works avatar

That's a very bleak future... at least for me.

Eccitaze ,
@Eccitaze@yiffit.net avatar

I haven't accidentally deleted a bunch of data yet (which, considering 99% of my interaction with Linux is when I'm SSH'd into a user's server, I am very paranoid about not doing), but I have run fsck on a volume without mounting the read/write flashcache with dirty blocks on it first.

Oops.

0x4E4F OP ,
@0x4E4F@sh.itjust.works avatar

It will happen to you sooner or later 😂... we're all dead on a long enough time scale 🤷 😂.

Pete90 ,

I did, and it was fast. I was a complete noob, so I thought rm -rf /* would delete everything in the current folder. I hit Ctrl + C, but it was too late. Took a few seconds to wipe out the whole system.

Honytawk ,

Now wonder, which one is will be preferred by people who aren't tech savvy.

porl ,

They are not likely to be using the terminal. Pretty much every graphical file browser will ask for confirmation upon delete, and many will use a rubbish bin by default.

Ziglin ,

To be fair, assuming you are not using a wastebasket which comes pre installed in a lot of distros, you still need the right permissions to delete files that belong to the system and if you're using rm you have to use the -rf option to remove a folder and it's contents.

MonkderZweite ,

gio trash

palordrolap ,

This works for those of us in GNOME and GNOME-derived places.

Seems like KDE doesn't have anything quite so simple. A quick web search suggests the correct command is kioclientN move filename trash:/ where N is the version number of kioclient. Very verbose. Worthy of a shell alias.

MonkderZweite , (edited )

Then there's stuff like bashtrash. Or just write a small function, without full XDG compliance and all the edge cases.

d_k_bo ,
stepanzak ,
tfw_no_toiletpaper ,

If you're going for cli, windows also can do rm -r -Force <path>

Hupf ,

Use the --force Luke

Diplomjodler ,

Or just do Shift Delete in Explorer.

eatham ,
@eatham@aussie.zone avatar

You can do that?

Diplomjodler ,

Yes. Place finger on key and press lightly downward. ;)

capital , (edited )
-confirm:$false
0x4E4F OP ,
@0x4E4F@sh.itjust.works avatar

Yeah, but get this! It's not enough to just envoke cmd in Windows with just Win+R (sorry, sorry... Super+R 😁), even though you're invoking it from an admin account, no sir, it's still just a plain user as long as cmd is concerned 😂.

And this is what you get when you wanna do backwards compatibility all the way down to DOS 😂.

Ziglin ,

We have pretty good backwards compatibility too, to my knowledge it's actually better.

0x4E4F OP ,
@0x4E4F@sh.itjust.works avatar

My point was, MS has backwards compatibility all the way down to an OS that has no sense of users and permissions and that is why Windows, even nowadays, has these problems. If you get rid of the DOS legacy stuff, you can have decent user permission and security in place, but too much shit relies on legacy code, so they keep it.

jbk ,

backups / btrfs snapshots

maiskanzler ,

Btrfs snapshots/subvolumes can now also be deleted with rm. It's no longer necessary to use 'btrfs subvolume delete'

0x4E4F OP ,
@0x4E4F@sh.itjust.works avatar

Really?

As I always say, you get the best linux info from linux memes 😁.

maiskanzler ,

Yep! (finally)

IsThisAnAI ,

Every time I see I've of these memes my mind goes straight to infomercials.

Duke_Nukem_1990 ,

Oh well. Didn't really like my mum that much anyways 😢

0x4E4F OP ,
@0x4E4F@sh.itjust.works avatar

Mom enters the chat...

EnderMB ,

One of my first experiences with Linux at university was watching a classmate install Slackware, and then (for a laugh) dragging everything into the recycle bin.

They got a passing grade, because the lecturer saw their working installation, but they learned a valuable lesson in Linux that if you delete something, it'll fucking delete it.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • linuxmemes@lemmy.world
  • incremental_games
  • meta
  • All magazines