4 ms·
The point is that that would offer no benefit. A root user can just mount it rw again in a single call.
by microcolonel 11y ago
The point is that that would offer no benefit. A root user can just mount it rw again in a single call.
- pjmlp 11y agoSo in a similar vein, why bother with alias rm='rm -i' at all?
- Ao7bei3s 11y agoBut that doesn't actually exist by default, and so it's not a good example. A better example is that `/` is a special case for `rm`. (Besides: I'm not a fan of `rm -i`, precisely because it's non-default. You'll get used to it, and then someday you accidentally some files on a system where you didn't add the alias.)
- pjmlp 11y agoLots of GNU/Linux distributions used to it by default, has it changed?
- Ao7bei3s 11y agoNone I currently use (just tested with bash* on: Debian, Centos, Fedora, OpenWRT) or have used in the past few years (Arch) has it. I don't remember anything about my time with SUSE and Ubuntu, thats way back. * I normally use zsh with grmlzshrc and nearly no customization (which is why I love grmlzshrc -- usable defaults), which warns for `rm -rf foo/*` but not for `rm -rf foo`.
- pjmlp 11y agoMaybe I am wrong but I think Red-Hat, Mandrake and SuSE used to do it. Nowadays I spend most of my time in Windows and mobile OSes to remember it properly.
- SEJeff 11y agoRedhat based distros absolutely do enable alias rm='rm -i' out of the box, but only for the root user. As a career SysAdmin, that seems like a good compromise. If you want to take the safety net off, you can escape out the alias (or any alias) with a slash i.e.: \rm -rf somedir Yet by default, if you don't include the "\", you get rm -i
- Ao7bei3s 11y agoYou're right about RedHat, sorry. .bash_history says I accidentally added `-f` on that host. I should have just checked with `which` instead of trying it out. Oops.
- SEJeff 11y agoActually even if you do rm -f, the -i will still be added if it is an alias. Better is to use the bash builtin "type": type rm is better than which rm, but it depends on what distro you're using. Some distros (Just checked on RHEL7) will fancify which as well ie: $ type which which is aliased to `alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
- Ao7bei3s 11y ago> Actually even if you do rm -f, the -i will still be added if it is an alias. Yes, I know, but rm ignores -i if -f is given. [root@example ~]# touch blah [root@example ~]# rm -i -f blah [root@example ~]# And hence: [root@example ~]# which rm alias rm='rm -i' /usr/bin/rm [root@example ~]# touch blah [root@example ~]# rm -f blah [root@example ~]# @type: yes, you're right, thanks for the reminder.
- jhkaghjkga 11y agoSane distributions don't include that alias by default. Because otherwise people will always use `rm -f` and lose the feature that `rm` asks before removing files marked as read-only.
- pjmlp 11y agoThen quite a few distributions are not sane, as I remember once a upon a time it was quite common to have it like that on fresh install.