Hacker News new | ask | show | jobs
by godelski 158 days ago

  >> Linux won't stop you if you try to use a command that deletes every file on your PC ("sudo rm -rf /").

  > It will definitely stop you from running that command
You're protected against removing / but your can still run `rm -rf /` and even as a user that'll do a lot of damage.

I think for the average person this would be synonymous to "every file on your PC". It is all the files that they care about. It deletes everything they have permission for. Everything they* own. For the average user `rm -rf /` is no different than `sudo rm -rf --no-preserve-root /`

That said, some* systems have some protections. It is common to see the following aliases in the default .bashrc (check your /etc/skel/.bashrc) but also we have to ask the question "is this a bad thing?" I'm not so sure the answer is as clear as people like to suggest it is. But you're asking your computer to do something and either it is going to do that thing or it is going to refuse. I'm personally on the side that a computer refusing to do what you ask it to do is a worse thing, but I can also understand why people want to add in precautions to protect users. Sudo is even one of those!

I'd also suggest adding the following to your ~/.bashrc and would encourage distro makes to put this in /etc/skel/.bashrc

  alias rm='rm -I' # Ask for confirmation if deleting more than 3 files
  #alias rm='rm -i' # Ask for confirmation if deleting files
  alias cp='cp -i' # Ask for confirmation if overwriting files
  alias mv='mv -i' # Ask for confirmation if overwriting files
This can help reduce mistakes. It has saved me on multiple occasions and I've been using linux for over a decade. And honestly, I am deeply frustrated every time I have to touch a Windows machine. I have terrible experiences and it has never "Just worked". With my last work laptop with windows (2024) I learned that Windows Hello (login with fingerprint) likes to break Outlook. The fact that this was a known issue to my IT team kinda highlights how disorganized Microsoft is. FWIW I do also use a Macbook Air as a daily driver but to be frank, for any work it is an overpriced SSH machine. I haven't tried a linux netbook in a few years but that would be ideal if it can actually have long battery life. Biggest help is that Microsoft is inadvertently being less hostile to linux users by making everything cloud based. I hate cloud apps but at least I don't have to have their shitty software on my computer to read a Word document (and because people can't just normalize sending PDFs)