Why is it possible to delete your entire file system
so after committing the infamous mistake of deleting my entire file system via sudo rm -rf /*, recovering from the horrendous damage that i had done and coping with the fact that i just lost 6 years off my lifespan, i started wondering why is it even possible to do that, and what could be done to prevent this mistake from happening.
One solution that i was suggested is revoking root access from my account, but that is inconvenient, because a lot of commands require root access and when you have to run a few dozen commands every day that gets annoying.
Backing up your system is the obvious way to go but restoring a backup also requires some downtime, and depending on your system that downtime could be days or weeks, which could be unacceptable in some cases.
So my question is: Why not implement a confirmation when the user tries to delete his filesystem? So that way when you actually want to do that, you just hit Y or enter, and if you don't at least you don't loose everything.
command-line rm
New contributor
Iliya Golik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
|
show 5 more comments
so after committing the infamous mistake of deleting my entire file system via sudo rm -rf /*, recovering from the horrendous damage that i had done and coping with the fact that i just lost 6 years off my lifespan, i started wondering why is it even possible to do that, and what could be done to prevent this mistake from happening.
One solution that i was suggested is revoking root access from my account, but that is inconvenient, because a lot of commands require root access and when you have to run a few dozen commands every day that gets annoying.
Backing up your system is the obvious way to go but restoring a backup also requires some downtime, and depending on your system that downtime could be days or weeks, which could be unacceptable in some cases.
So my question is: Why not implement a confirmation when the user tries to delete his filesystem? So that way when you actually want to do that, you just hit Y or enter, and if you don't at least you don't loose everything.
command-line rm
New contributor
Iliya Golik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
16
That "confirmation" won't stop anyone. If you usesudoin a terminal, you should know what you are doing. Period.
– Pilot6
8 hours ago
1
@Pilot6 i'm not putting blame on anyone here, it is my fault i didn't know better, and i learned from my mistake, but there's other probably clueless people who could do this by accident, and nuke their entire system, they probably don't want that. a simple confirmation won't get in the way of anyone who actually wants to nuke their system while saving everyone else from a major mistake.
– Iliya Golik
8 hours ago
10
What was the point of using-f? Without it you would get some warning, but it didn't stop you.
– Pilot6
8 hours ago
9
-rfor recursive would be sufficient, no need to force. But as soon as you forced it, there is noone to blame. You need to learn what these options mean.
– Pilot6
8 hours ago
5
"Why is it even possible to do that?" Why should't it be possible? There are perfectly good reasons to delete the contents of a directory hierarchy, and there are plenty of subsets of/that would be nearly as bad to delete (/etc/, for example). It simply is not the job ofrmto decide which directories can or can't easily be deleted.
– chepner
3 hours ago
|
show 5 more comments
so after committing the infamous mistake of deleting my entire file system via sudo rm -rf /*, recovering from the horrendous damage that i had done and coping with the fact that i just lost 6 years off my lifespan, i started wondering why is it even possible to do that, and what could be done to prevent this mistake from happening.
One solution that i was suggested is revoking root access from my account, but that is inconvenient, because a lot of commands require root access and when you have to run a few dozen commands every day that gets annoying.
Backing up your system is the obvious way to go but restoring a backup also requires some downtime, and depending on your system that downtime could be days or weeks, which could be unacceptable in some cases.
So my question is: Why not implement a confirmation when the user tries to delete his filesystem? So that way when you actually want to do that, you just hit Y or enter, and if you don't at least you don't loose everything.
command-line rm
New contributor
Iliya Golik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
so after committing the infamous mistake of deleting my entire file system via sudo rm -rf /*, recovering from the horrendous damage that i had done and coping with the fact that i just lost 6 years off my lifespan, i started wondering why is it even possible to do that, and what could be done to prevent this mistake from happening.
One solution that i was suggested is revoking root access from my account, but that is inconvenient, because a lot of commands require root access and when you have to run a few dozen commands every day that gets annoying.
Backing up your system is the obvious way to go but restoring a backup also requires some downtime, and depending on your system that downtime could be days or weeks, which could be unacceptable in some cases.
So my question is: Why not implement a confirmation when the user tries to delete his filesystem? So that way when you actually want to do that, you just hit Y or enter, and if you don't at least you don't loose everything.
command-line rm
command-line rm
New contributor
Iliya Golik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Iliya Golik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 18 mins ago
Iliya Golik
New contributor
Iliya Golik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 8 hours ago
Iliya GolikIliya Golik
565
565
New contributor
Iliya Golik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Iliya Golik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Iliya Golik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
16
That "confirmation" won't stop anyone. If you usesudoin a terminal, you should know what you are doing. Period.
– Pilot6
8 hours ago
1
@Pilot6 i'm not putting blame on anyone here, it is my fault i didn't know better, and i learned from my mistake, but there's other probably clueless people who could do this by accident, and nuke their entire system, they probably don't want that. a simple confirmation won't get in the way of anyone who actually wants to nuke their system while saving everyone else from a major mistake.
– Iliya Golik
8 hours ago
10
What was the point of using-f? Without it you would get some warning, but it didn't stop you.
– Pilot6
8 hours ago
9
-rfor recursive would be sufficient, no need to force. But as soon as you forced it, there is noone to blame. You need to learn what these options mean.
– Pilot6
8 hours ago
5
"Why is it even possible to do that?" Why should't it be possible? There are perfectly good reasons to delete the contents of a directory hierarchy, and there are plenty of subsets of/that would be nearly as bad to delete (/etc/, for example). It simply is not the job ofrmto decide which directories can or can't easily be deleted.
– chepner
3 hours ago
|
show 5 more comments
16
That "confirmation" won't stop anyone. If you usesudoin a terminal, you should know what you are doing. Period.
– Pilot6
8 hours ago
1
@Pilot6 i'm not putting blame on anyone here, it is my fault i didn't know better, and i learned from my mistake, but there's other probably clueless people who could do this by accident, and nuke their entire system, they probably don't want that. a simple confirmation won't get in the way of anyone who actually wants to nuke their system while saving everyone else from a major mistake.
– Iliya Golik
8 hours ago
10
What was the point of using-f? Without it you would get some warning, but it didn't stop you.
– Pilot6
8 hours ago
9
-rfor recursive would be sufficient, no need to force. But as soon as you forced it, there is noone to blame. You need to learn what these options mean.
– Pilot6
8 hours ago
5
"Why is it even possible to do that?" Why should't it be possible? There are perfectly good reasons to delete the contents of a directory hierarchy, and there are plenty of subsets of/that would be nearly as bad to delete (/etc/, for example). It simply is not the job ofrmto decide which directories can or can't easily be deleted.
– chepner
3 hours ago
16
16
That "confirmation" won't stop anyone. If you use
sudo in a terminal, you should know what you are doing. Period.– Pilot6
8 hours ago
That "confirmation" won't stop anyone. If you use
sudo in a terminal, you should know what you are doing. Period.– Pilot6
8 hours ago
1
1
@Pilot6 i'm not putting blame on anyone here, it is my fault i didn't know better, and i learned from my mistake, but there's other probably clueless people who could do this by accident, and nuke their entire system, they probably don't want that. a simple confirmation won't get in the way of anyone who actually wants to nuke their system while saving everyone else from a major mistake.
– Iliya Golik
8 hours ago
@Pilot6 i'm not putting blame on anyone here, it is my fault i didn't know better, and i learned from my mistake, but there's other probably clueless people who could do this by accident, and nuke their entire system, they probably don't want that. a simple confirmation won't get in the way of anyone who actually wants to nuke their system while saving everyone else from a major mistake.
– Iliya Golik
8 hours ago
10
10
What was the point of using
-f? Without it you would get some warning, but it didn't stop you.– Pilot6
8 hours ago
What was the point of using
-f? Without it you would get some warning, but it didn't stop you.– Pilot6
8 hours ago
9
9
-r for recursive would be sufficient, no need to force. But as soon as you forced it, there is noone to blame. You need to learn what these options mean.– Pilot6
8 hours ago
-r for recursive would be sufficient, no need to force. But as soon as you forced it, there is noone to blame. You need to learn what these options mean.– Pilot6
8 hours ago
5
5
"Why is it even possible to do that?" Why should't it be possible? There are perfectly good reasons to delete the contents of a directory hierarchy, and there are plenty of subsets of
/ that would be nearly as bad to delete (/etc/, for example). It simply is not the job of rm to decide which directories can or can't easily be deleted.– chepner
3 hours ago
"Why is it even possible to do that?" Why should't it be possible? There are perfectly good reasons to delete the contents of a directory hierarchy, and there are plenty of subsets of
/ that would be nearly as bad to delete (/etc/, for example). It simply is not the job of rm to decide which directories can or can't easily be deleted.– chepner
3 hours ago
|
show 5 more comments
5 Answers
5
active
oldest
votes
Meet safe-rm, the “wrapper around the
rm command to prevent accidental deletions”:
safe-rm prevents the accidental deletion of important files by
replacingrmwith a wrapper
which checks the given arguments against a configurable blacklist of files and directories
which should never be removed.
Users who attempt to delete one of these protected files or directories will not be able
to do so and will be shown a warning message instead. (man safe-rm)
If the installation link above doesn’t work for you just use sudo apt install safe-rm instead.
The default configuration already contains the system directories, let’s try rm /* for example:
$ rm /*
safe-rm: skipping /bin
safe-rm: skipping /boot
safe-rm: skipping /dev
safe-rm: skipping /etc
safe-rm: skipping /home
safe-rm: skipping /lib
safe-rm: skipping /proc
safe-rm: skipping /root
safe-rm: skipping /sbin
safe-rm: skipping /sys
safe-rm: skipping /usr
safe-rm: skipping /var
…
For the cases where you run rm without sudo (which ignores aliases) and the -f flag it’s a good idea to add an alias for your shell that makes rm’s -i flag the default. This way rm asks for every file before deleting it:
alias rm='rm -i'
A similarly useful flag is -I:
prompt once before removing more than three files, or when removing
recursively;
less intrusive than -i, while still giving protection against most mistakes
When I click the link to "safe-rm" it says "Please wait The package you requested will install shortly." How do I get to the instructions how to install it?
– Ferrybig
2 hours ago
add a comment |
Confirmation is already there, the problem is the f of the command, that is --force; When user force an operation it is suppose it's know what is doing (obviously a mistake could always append).
an example:
rm -r ./*
rm: remove write-protected regular file './mozilla_mvaschetto0/WEBMASTER-04.DOC'? N
rm: cannot remove './mozilla_mvaschetto0': Directory not empty
rm: descend into write-protected directory './pulse-PKdhtXMmr18n'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-bolt.service-rZWMCb'? n
rm: descend into write-protected directory './systemd-private- 890f5b31987b4910a579d1c49930a591-colord.service-4ZBnUf'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-fwupd.service-vAxdbk'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-minissdpd.service-9G8GrR'?
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-ModemManager.service-s43zUX'? nn
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-rtkit-daemon.service-cfMePv'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-systemd-timesyncd.service-oXT4pr'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-upower.service-L0k9rT'? n
it is different with --force option, I will not get any confirmation and files are deleted.
The Problem is to know the command and its parameters, navigate more in the man of a command (also if the command is found in a tutorial) for examples: the first time I sow the command tar xzf some.tar.gz I'm asking to my self, what xzf mean?
Then I red the man of tar and discover it.
I don’t think that’s relevant here. At the point where rm first asks for a write-protected or whatever file, it may already have deleted a whole bunch of important files.
– Jonas Schäfer
6 hours ago
So personally, I have always thought-fwas required to delete folders. I even opened a prompt to confirm and complain but learned that just-ris needed. I supposerm -rfhas become the norm since it is so useful in a script (you don't want the script to fail just because you're trying to delete things that don't exist) so you see it often, but I suppose we need to be vigilant about just usingrm -ras our "default" when in a shell (understandably there should be no "default" assumptions you don't understand, especially with sudo, but people will be people and at least this is safer).
– Captain Man
4 hours ago
Rmdir is the safest way to delete a folder
– AtomiX84
4 hours ago
add a comment |
If your system file space usage isn't immense (and these days 'immense' means 'hundreds of gigabytes or more') create some virtual machine instances, and always work inside of one. Recovery would just entail using a backup instance.
Or you could create a chroot jail, and work inside it. You'd still need some recovery if it got trashed, but that would be easier with a running (enclosing) system to work from.
This is probably the most effective answer, since it can protect against any damage, even third party scripts. You'd only have to worry about actual malware.
– PyRulez
4 hours ago
Thought of another angle. It's worth asking why you need to do recursive deletions in the first place. Maybe what's really needed are some scripts to remove a project, etc.
– Loren Rosen
3 hours ago
"It's worth asking why you need to do recursive deletions in the first place." Well, just because there's not built in command doesn't mean you still can't make a mistake. Third party scripts might delete files one by one from some directory. And there are other ways to bork the system that only touch one file. However, replacingrmwithsafe-rmhelps, at least.
– PyRulez
3 hours ago
My notion with the script was that it would have a built-in notion of a 'project' or similar. Perhaps you'd have an empty file at the project root called.project_root, or, if the file system supports it, an attribute on the directory itself. Then, the script would go up the file tree looking for the project root, and complain it the current directory wasn't in a project. Or, if the projects all live in same place, the script could require you to name a project. You could still delete the wrong project, but not destroy the entire system.
– Loren Rosen
3 hours ago
... also, a variant ofchrootwould be to use something like Docker (which I think actually useschrootunder the covers). For other files you just need to read, mount a read-only file-system.
– Loren Rosen
3 hours ago
add a comment |
Well the short answer is to not run such a command.
The long story is that it's part of the customization. Essentially there are two factors at play here. One is the fact that you are free to modify all files.
The second is that the rm command offers the helpful syntactic sugar to delete all files under a folder.
Effectively this could be restated as a singe simple tenet of Unix machines. Everything is a file. To make matters better, there are access controls, but there are overridden by your usage of
sudo
I guess you could add an alias or a function to ensure that this can never be run.
add a comment |
Be wary of using /* with the rm at all. It might be tedious to remove things one folder at a time, but remove all could create a tedious restore from backup. Because of course you backed up.
New contributor
Zach is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Linux Mint is not a “bad word” here, but simply off topic on this site, see the help center – if you have a question about your Linux Mint system, feel free to post it on a site where it’s on topic, e.g. Unix & Linux or the Linux Mint forums.
– dessert
54 mins ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Iliya Golik is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1117684%2fwhy-is-it-possible-to-delete-your-entire-file-system%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
Meet safe-rm, the “wrapper around the
rm command to prevent accidental deletions”:
safe-rm prevents the accidental deletion of important files by
replacingrmwith a wrapper
which checks the given arguments against a configurable blacklist of files and directories
which should never be removed.
Users who attempt to delete one of these protected files or directories will not be able
to do so and will be shown a warning message instead. (man safe-rm)
If the installation link above doesn’t work for you just use sudo apt install safe-rm instead.
The default configuration already contains the system directories, let’s try rm /* for example:
$ rm /*
safe-rm: skipping /bin
safe-rm: skipping /boot
safe-rm: skipping /dev
safe-rm: skipping /etc
safe-rm: skipping /home
safe-rm: skipping /lib
safe-rm: skipping /proc
safe-rm: skipping /root
safe-rm: skipping /sbin
safe-rm: skipping /sys
safe-rm: skipping /usr
safe-rm: skipping /var
…
For the cases where you run rm without sudo (which ignores aliases) and the -f flag it’s a good idea to add an alias for your shell that makes rm’s -i flag the default. This way rm asks for every file before deleting it:
alias rm='rm -i'
A similarly useful flag is -I:
prompt once before removing more than three files, or when removing
recursively;
less intrusive than -i, while still giving protection against most mistakes
When I click the link to "safe-rm" it says "Please wait The package you requested will install shortly." How do I get to the instructions how to install it?
– Ferrybig
2 hours ago
add a comment |
Meet safe-rm, the “wrapper around the
rm command to prevent accidental deletions”:
safe-rm prevents the accidental deletion of important files by
replacingrmwith a wrapper
which checks the given arguments against a configurable blacklist of files and directories
which should never be removed.
Users who attempt to delete one of these protected files or directories will not be able
to do so and will be shown a warning message instead. (man safe-rm)
If the installation link above doesn’t work for you just use sudo apt install safe-rm instead.
The default configuration already contains the system directories, let’s try rm /* for example:
$ rm /*
safe-rm: skipping /bin
safe-rm: skipping /boot
safe-rm: skipping /dev
safe-rm: skipping /etc
safe-rm: skipping /home
safe-rm: skipping /lib
safe-rm: skipping /proc
safe-rm: skipping /root
safe-rm: skipping /sbin
safe-rm: skipping /sys
safe-rm: skipping /usr
safe-rm: skipping /var
…
For the cases where you run rm without sudo (which ignores aliases) and the -f flag it’s a good idea to add an alias for your shell that makes rm’s -i flag the default. This way rm asks for every file before deleting it:
alias rm='rm -i'
A similarly useful flag is -I:
prompt once before removing more than three files, or when removing
recursively;
less intrusive than -i, while still giving protection against most mistakes
When I click the link to "safe-rm" it says "Please wait The package you requested will install shortly." How do I get to the instructions how to install it?
– Ferrybig
2 hours ago
add a comment |
Meet safe-rm, the “wrapper around the
rm command to prevent accidental deletions”:
safe-rm prevents the accidental deletion of important files by
replacingrmwith a wrapper
which checks the given arguments against a configurable blacklist of files and directories
which should never be removed.
Users who attempt to delete one of these protected files or directories will not be able
to do so and will be shown a warning message instead. (man safe-rm)
If the installation link above doesn’t work for you just use sudo apt install safe-rm instead.
The default configuration already contains the system directories, let’s try rm /* for example:
$ rm /*
safe-rm: skipping /bin
safe-rm: skipping /boot
safe-rm: skipping /dev
safe-rm: skipping /etc
safe-rm: skipping /home
safe-rm: skipping /lib
safe-rm: skipping /proc
safe-rm: skipping /root
safe-rm: skipping /sbin
safe-rm: skipping /sys
safe-rm: skipping /usr
safe-rm: skipping /var
…
For the cases where you run rm without sudo (which ignores aliases) and the -f flag it’s a good idea to add an alias for your shell that makes rm’s -i flag the default. This way rm asks for every file before deleting it:
alias rm='rm -i'
A similarly useful flag is -I:
prompt once before removing more than three files, or when removing
recursively;
less intrusive than -i, while still giving protection against most mistakes
Meet safe-rm, the “wrapper around the
rm command to prevent accidental deletions”:
safe-rm prevents the accidental deletion of important files by
replacingrmwith a wrapper
which checks the given arguments against a configurable blacklist of files and directories
which should never be removed.
Users who attempt to delete one of these protected files or directories will not be able
to do so and will be shown a warning message instead. (man safe-rm)
If the installation link above doesn’t work for you just use sudo apt install safe-rm instead.
The default configuration already contains the system directories, let’s try rm /* for example:
$ rm /*
safe-rm: skipping /bin
safe-rm: skipping /boot
safe-rm: skipping /dev
safe-rm: skipping /etc
safe-rm: skipping /home
safe-rm: skipping /lib
safe-rm: skipping /proc
safe-rm: skipping /root
safe-rm: skipping /sbin
safe-rm: skipping /sys
safe-rm: skipping /usr
safe-rm: skipping /var
…
For the cases where you run rm without sudo (which ignores aliases) and the -f flag it’s a good idea to add an alias for your shell that makes rm’s -i flag the default. This way rm asks for every file before deleting it:
alias rm='rm -i'
A similarly useful flag is -I:
prompt once before removing more than three files, or when removing
recursively;
less intrusive than -i, while still giving protection against most mistakes
edited 2 hours ago
answered 8 hours ago
dessertdessert
23.2k565103
23.2k565103
When I click the link to "safe-rm" it says "Please wait The package you requested will install shortly." How do I get to the instructions how to install it?
– Ferrybig
2 hours ago
add a comment |
When I click the link to "safe-rm" it says "Please wait The package you requested will install shortly." How do I get to the instructions how to install it?
– Ferrybig
2 hours ago
When I click the link to "safe-rm" it says "Please wait The package you requested will install shortly." How do I get to the instructions how to install it?
– Ferrybig
2 hours ago
When I click the link to "safe-rm" it says "Please wait The package you requested will install shortly." How do I get to the instructions how to install it?
– Ferrybig
2 hours ago
add a comment |
Confirmation is already there, the problem is the f of the command, that is --force; When user force an operation it is suppose it's know what is doing (obviously a mistake could always append).
an example:
rm -r ./*
rm: remove write-protected regular file './mozilla_mvaschetto0/WEBMASTER-04.DOC'? N
rm: cannot remove './mozilla_mvaschetto0': Directory not empty
rm: descend into write-protected directory './pulse-PKdhtXMmr18n'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-bolt.service-rZWMCb'? n
rm: descend into write-protected directory './systemd-private- 890f5b31987b4910a579d1c49930a591-colord.service-4ZBnUf'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-fwupd.service-vAxdbk'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-minissdpd.service-9G8GrR'?
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-ModemManager.service-s43zUX'? nn
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-rtkit-daemon.service-cfMePv'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-systemd-timesyncd.service-oXT4pr'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-upower.service-L0k9rT'? n
it is different with --force option, I will not get any confirmation and files are deleted.
The Problem is to know the command and its parameters, navigate more in the man of a command (also if the command is found in a tutorial) for examples: the first time I sow the command tar xzf some.tar.gz I'm asking to my self, what xzf mean?
Then I red the man of tar and discover it.
I don’t think that’s relevant here. At the point where rm first asks for a write-protected or whatever file, it may already have deleted a whole bunch of important files.
– Jonas Schäfer
6 hours ago
So personally, I have always thought-fwas required to delete folders. I even opened a prompt to confirm and complain but learned that just-ris needed. I supposerm -rfhas become the norm since it is so useful in a script (you don't want the script to fail just because you're trying to delete things that don't exist) so you see it often, but I suppose we need to be vigilant about just usingrm -ras our "default" when in a shell (understandably there should be no "default" assumptions you don't understand, especially with sudo, but people will be people and at least this is safer).
– Captain Man
4 hours ago
Rmdir is the safest way to delete a folder
– AtomiX84
4 hours ago
add a comment |
Confirmation is already there, the problem is the f of the command, that is --force; When user force an operation it is suppose it's know what is doing (obviously a mistake could always append).
an example:
rm -r ./*
rm: remove write-protected regular file './mozilla_mvaschetto0/WEBMASTER-04.DOC'? N
rm: cannot remove './mozilla_mvaschetto0': Directory not empty
rm: descend into write-protected directory './pulse-PKdhtXMmr18n'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-bolt.service-rZWMCb'? n
rm: descend into write-protected directory './systemd-private- 890f5b31987b4910a579d1c49930a591-colord.service-4ZBnUf'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-fwupd.service-vAxdbk'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-minissdpd.service-9G8GrR'?
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-ModemManager.service-s43zUX'? nn
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-rtkit-daemon.service-cfMePv'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-systemd-timesyncd.service-oXT4pr'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-upower.service-L0k9rT'? n
it is different with --force option, I will not get any confirmation and files are deleted.
The Problem is to know the command and its parameters, navigate more in the man of a command (also if the command is found in a tutorial) for examples: the first time I sow the command tar xzf some.tar.gz I'm asking to my self, what xzf mean?
Then I red the man of tar and discover it.
I don’t think that’s relevant here. At the point where rm first asks for a write-protected or whatever file, it may already have deleted a whole bunch of important files.
– Jonas Schäfer
6 hours ago
So personally, I have always thought-fwas required to delete folders. I even opened a prompt to confirm and complain but learned that just-ris needed. I supposerm -rfhas become the norm since it is so useful in a script (you don't want the script to fail just because you're trying to delete things that don't exist) so you see it often, but I suppose we need to be vigilant about just usingrm -ras our "default" when in a shell (understandably there should be no "default" assumptions you don't understand, especially with sudo, but people will be people and at least this is safer).
– Captain Man
4 hours ago
Rmdir is the safest way to delete a folder
– AtomiX84
4 hours ago
add a comment |
Confirmation is already there, the problem is the f of the command, that is --force; When user force an operation it is suppose it's know what is doing (obviously a mistake could always append).
an example:
rm -r ./*
rm: remove write-protected regular file './mozilla_mvaschetto0/WEBMASTER-04.DOC'? N
rm: cannot remove './mozilla_mvaschetto0': Directory not empty
rm: descend into write-protected directory './pulse-PKdhtXMmr18n'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-bolt.service-rZWMCb'? n
rm: descend into write-protected directory './systemd-private- 890f5b31987b4910a579d1c49930a591-colord.service-4ZBnUf'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-fwupd.service-vAxdbk'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-minissdpd.service-9G8GrR'?
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-ModemManager.service-s43zUX'? nn
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-rtkit-daemon.service-cfMePv'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-systemd-timesyncd.service-oXT4pr'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-upower.service-L0k9rT'? n
it is different with --force option, I will not get any confirmation and files are deleted.
The Problem is to know the command and its parameters, navigate more in the man of a command (also if the command is found in a tutorial) for examples: the first time I sow the command tar xzf some.tar.gz I'm asking to my self, what xzf mean?
Then I red the man of tar and discover it.
Confirmation is already there, the problem is the f of the command, that is --force; When user force an operation it is suppose it's know what is doing (obviously a mistake could always append).
an example:
rm -r ./*
rm: remove write-protected regular file './mozilla_mvaschetto0/WEBMASTER-04.DOC'? N
rm: cannot remove './mozilla_mvaschetto0': Directory not empty
rm: descend into write-protected directory './pulse-PKdhtXMmr18n'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-bolt.service-rZWMCb'? n
rm: descend into write-protected directory './systemd-private- 890f5b31987b4910a579d1c49930a591-colord.service-4ZBnUf'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-fwupd.service-vAxdbk'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-minissdpd.service-9G8GrR'?
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-ModemManager.service-s43zUX'? nn
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-rtkit-daemon.service-cfMePv'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-systemd-timesyncd.service-oXT4pr'? n
rm: descend into write-protected directory './systemd-private-890f5b31987b4910a579d1c49930a591-upower.service-L0k9rT'? n
it is different with --force option, I will not get any confirmation and files are deleted.
The Problem is to know the command and its parameters, navigate more in the man of a command (also if the command is found in a tutorial) for examples: the first time I sow the command tar xzf some.tar.gz I'm asking to my self, what xzf mean?
Then I red the man of tar and discover it.
answered 8 hours ago
AtomiX84AtomiX84
805110
805110
I don’t think that’s relevant here. At the point where rm first asks for a write-protected or whatever file, it may already have deleted a whole bunch of important files.
– Jonas Schäfer
6 hours ago
So personally, I have always thought-fwas required to delete folders. I even opened a prompt to confirm and complain but learned that just-ris needed. I supposerm -rfhas become the norm since it is so useful in a script (you don't want the script to fail just because you're trying to delete things that don't exist) so you see it often, but I suppose we need to be vigilant about just usingrm -ras our "default" when in a shell (understandably there should be no "default" assumptions you don't understand, especially with sudo, but people will be people and at least this is safer).
– Captain Man
4 hours ago
Rmdir is the safest way to delete a folder
– AtomiX84
4 hours ago
add a comment |
I don’t think that’s relevant here. At the point where rm first asks for a write-protected or whatever file, it may already have deleted a whole bunch of important files.
– Jonas Schäfer
6 hours ago
So personally, I have always thought-fwas required to delete folders. I even opened a prompt to confirm and complain but learned that just-ris needed. I supposerm -rfhas become the norm since it is so useful in a script (you don't want the script to fail just because you're trying to delete things that don't exist) so you see it often, but I suppose we need to be vigilant about just usingrm -ras our "default" when in a shell (understandably there should be no "default" assumptions you don't understand, especially with sudo, but people will be people and at least this is safer).
– Captain Man
4 hours ago
Rmdir is the safest way to delete a folder
– AtomiX84
4 hours ago
I don’t think that’s relevant here. At the point where rm first asks for a write-protected or whatever file, it may already have deleted a whole bunch of important files.
– Jonas Schäfer
6 hours ago
I don’t think that’s relevant here. At the point where rm first asks for a write-protected or whatever file, it may already have deleted a whole bunch of important files.
– Jonas Schäfer
6 hours ago
So personally, I have always thought
-f was required to delete folders. I even opened a prompt to confirm and complain but learned that just -r is needed. I suppose rm -rf has become the norm since it is so useful in a script (you don't want the script to fail just because you're trying to delete things that don't exist) so you see it often, but I suppose we need to be vigilant about just using rm -r as our "default" when in a shell (understandably there should be no "default" assumptions you don't understand, especially with sudo, but people will be people and at least this is safer).– Captain Man
4 hours ago
So personally, I have always thought
-f was required to delete folders. I even opened a prompt to confirm and complain but learned that just -r is needed. I suppose rm -rf has become the norm since it is so useful in a script (you don't want the script to fail just because you're trying to delete things that don't exist) so you see it often, but I suppose we need to be vigilant about just using rm -r as our "default" when in a shell (understandably there should be no "default" assumptions you don't understand, especially with sudo, but people will be people and at least this is safer).– Captain Man
4 hours ago
Rmdir is the safest way to delete a folder
– AtomiX84
4 hours ago
Rmdir is the safest way to delete a folder
– AtomiX84
4 hours ago
add a comment |
If your system file space usage isn't immense (and these days 'immense' means 'hundreds of gigabytes or more') create some virtual machine instances, and always work inside of one. Recovery would just entail using a backup instance.
Or you could create a chroot jail, and work inside it. You'd still need some recovery if it got trashed, but that would be easier with a running (enclosing) system to work from.
This is probably the most effective answer, since it can protect against any damage, even third party scripts. You'd only have to worry about actual malware.
– PyRulez
4 hours ago
Thought of another angle. It's worth asking why you need to do recursive deletions in the first place. Maybe what's really needed are some scripts to remove a project, etc.
– Loren Rosen
3 hours ago
"It's worth asking why you need to do recursive deletions in the first place." Well, just because there's not built in command doesn't mean you still can't make a mistake. Third party scripts might delete files one by one from some directory. And there are other ways to bork the system that only touch one file. However, replacingrmwithsafe-rmhelps, at least.
– PyRulez
3 hours ago
My notion with the script was that it would have a built-in notion of a 'project' or similar. Perhaps you'd have an empty file at the project root called.project_root, or, if the file system supports it, an attribute on the directory itself. Then, the script would go up the file tree looking for the project root, and complain it the current directory wasn't in a project. Or, if the projects all live in same place, the script could require you to name a project. You could still delete the wrong project, but not destroy the entire system.
– Loren Rosen
3 hours ago
... also, a variant ofchrootwould be to use something like Docker (which I think actually useschrootunder the covers). For other files you just need to read, mount a read-only file-system.
– Loren Rosen
3 hours ago
add a comment |
If your system file space usage isn't immense (and these days 'immense' means 'hundreds of gigabytes or more') create some virtual machine instances, and always work inside of one. Recovery would just entail using a backup instance.
Or you could create a chroot jail, and work inside it. You'd still need some recovery if it got trashed, but that would be easier with a running (enclosing) system to work from.
This is probably the most effective answer, since it can protect against any damage, even third party scripts. You'd only have to worry about actual malware.
– PyRulez
4 hours ago
Thought of another angle. It's worth asking why you need to do recursive deletions in the first place. Maybe what's really needed are some scripts to remove a project, etc.
– Loren Rosen
3 hours ago
"It's worth asking why you need to do recursive deletions in the first place." Well, just because there's not built in command doesn't mean you still can't make a mistake. Third party scripts might delete files one by one from some directory. And there are other ways to bork the system that only touch one file. However, replacingrmwithsafe-rmhelps, at least.
– PyRulez
3 hours ago
My notion with the script was that it would have a built-in notion of a 'project' or similar. Perhaps you'd have an empty file at the project root called.project_root, or, if the file system supports it, an attribute on the directory itself. Then, the script would go up the file tree looking for the project root, and complain it the current directory wasn't in a project. Or, if the projects all live in same place, the script could require you to name a project. You could still delete the wrong project, but not destroy the entire system.
– Loren Rosen
3 hours ago
... also, a variant ofchrootwould be to use something like Docker (which I think actually useschrootunder the covers). For other files you just need to read, mount a read-only file-system.
– Loren Rosen
3 hours ago
add a comment |
If your system file space usage isn't immense (and these days 'immense' means 'hundreds of gigabytes or more') create some virtual machine instances, and always work inside of one. Recovery would just entail using a backup instance.
Or you could create a chroot jail, and work inside it. You'd still need some recovery if it got trashed, but that would be easier with a running (enclosing) system to work from.
If your system file space usage isn't immense (and these days 'immense' means 'hundreds of gigabytes or more') create some virtual machine instances, and always work inside of one. Recovery would just entail using a backup instance.
Or you could create a chroot jail, and work inside it. You'd still need some recovery if it got trashed, but that would be easier with a running (enclosing) system to work from.
answered 7 hours ago
Loren RosenLoren Rosen
363
363
This is probably the most effective answer, since it can protect against any damage, even third party scripts. You'd only have to worry about actual malware.
– PyRulez
4 hours ago
Thought of another angle. It's worth asking why you need to do recursive deletions in the first place. Maybe what's really needed are some scripts to remove a project, etc.
– Loren Rosen
3 hours ago
"It's worth asking why you need to do recursive deletions in the first place." Well, just because there's not built in command doesn't mean you still can't make a mistake. Third party scripts might delete files one by one from some directory. And there are other ways to bork the system that only touch one file. However, replacingrmwithsafe-rmhelps, at least.
– PyRulez
3 hours ago
My notion with the script was that it would have a built-in notion of a 'project' or similar. Perhaps you'd have an empty file at the project root called.project_root, or, if the file system supports it, an attribute on the directory itself. Then, the script would go up the file tree looking for the project root, and complain it the current directory wasn't in a project. Or, if the projects all live in same place, the script could require you to name a project. You could still delete the wrong project, but not destroy the entire system.
– Loren Rosen
3 hours ago
... also, a variant ofchrootwould be to use something like Docker (which I think actually useschrootunder the covers). For other files you just need to read, mount a read-only file-system.
– Loren Rosen
3 hours ago
add a comment |
This is probably the most effective answer, since it can protect against any damage, even third party scripts. You'd only have to worry about actual malware.
– PyRulez
4 hours ago
Thought of another angle. It's worth asking why you need to do recursive deletions in the first place. Maybe what's really needed are some scripts to remove a project, etc.
– Loren Rosen
3 hours ago
"It's worth asking why you need to do recursive deletions in the first place." Well, just because there's not built in command doesn't mean you still can't make a mistake. Third party scripts might delete files one by one from some directory. And there are other ways to bork the system that only touch one file. However, replacingrmwithsafe-rmhelps, at least.
– PyRulez
3 hours ago
My notion with the script was that it would have a built-in notion of a 'project' or similar. Perhaps you'd have an empty file at the project root called.project_root, or, if the file system supports it, an attribute on the directory itself. Then, the script would go up the file tree looking for the project root, and complain it the current directory wasn't in a project. Or, if the projects all live in same place, the script could require you to name a project. You could still delete the wrong project, but not destroy the entire system.
– Loren Rosen
3 hours ago
... also, a variant ofchrootwould be to use something like Docker (which I think actually useschrootunder the covers). For other files you just need to read, mount a read-only file-system.
– Loren Rosen
3 hours ago
This is probably the most effective answer, since it can protect against any damage, even third party scripts. You'd only have to worry about actual malware.
– PyRulez
4 hours ago
This is probably the most effective answer, since it can protect against any damage, even third party scripts. You'd only have to worry about actual malware.
– PyRulez
4 hours ago
Thought of another angle. It's worth asking why you need to do recursive deletions in the first place. Maybe what's really needed are some scripts to remove a project, etc.
– Loren Rosen
3 hours ago
Thought of another angle. It's worth asking why you need to do recursive deletions in the first place. Maybe what's really needed are some scripts to remove a project, etc.
– Loren Rosen
3 hours ago
"It's worth asking why you need to do recursive deletions in the first place." Well, just because there's not built in command doesn't mean you still can't make a mistake. Third party scripts might delete files one by one from some directory. And there are other ways to bork the system that only touch one file. However, replacing
rm with safe-rm helps, at least.– PyRulez
3 hours ago
"It's worth asking why you need to do recursive deletions in the first place." Well, just because there's not built in command doesn't mean you still can't make a mistake. Third party scripts might delete files one by one from some directory. And there are other ways to bork the system that only touch one file. However, replacing
rm with safe-rm helps, at least.– PyRulez
3 hours ago
My notion with the script was that it would have a built-in notion of a 'project' or similar. Perhaps you'd have an empty file at the project root called
.project_root, or, if the file system supports it, an attribute on the directory itself. Then, the script would go up the file tree looking for the project root, and complain it the current directory wasn't in a project. Or, if the projects all live in same place, the script could require you to name a project. You could still delete the wrong project, but not destroy the entire system.– Loren Rosen
3 hours ago
My notion with the script was that it would have a built-in notion of a 'project' or similar. Perhaps you'd have an empty file at the project root called
.project_root, or, if the file system supports it, an attribute on the directory itself. Then, the script would go up the file tree looking for the project root, and complain it the current directory wasn't in a project. Or, if the projects all live in same place, the script could require you to name a project. You could still delete the wrong project, but not destroy the entire system.– Loren Rosen
3 hours ago
... also, a variant of
chroot would be to use something like Docker (which I think actually uses chroot under the covers). For other files you just need to read, mount a read-only file-system.– Loren Rosen
3 hours ago
... also, a variant of
chroot would be to use something like Docker (which I think actually uses chroot under the covers). For other files you just need to read, mount a read-only file-system.– Loren Rosen
3 hours ago
add a comment |
Well the short answer is to not run such a command.
The long story is that it's part of the customization. Essentially there are two factors at play here. One is the fact that you are free to modify all files.
The second is that the rm command offers the helpful syntactic sugar to delete all files under a folder.
Effectively this could be restated as a singe simple tenet of Unix machines. Everything is a file. To make matters better, there are access controls, but there are overridden by your usage of
sudo
I guess you could add an alias or a function to ensure that this can never be run.
add a comment |
Well the short answer is to not run such a command.
The long story is that it's part of the customization. Essentially there are two factors at play here. One is the fact that you are free to modify all files.
The second is that the rm command offers the helpful syntactic sugar to delete all files under a folder.
Effectively this could be restated as a singe simple tenet of Unix machines. Everything is a file. To make matters better, there are access controls, but there are overridden by your usage of
sudo
I guess you could add an alias or a function to ensure that this can never be run.
add a comment |
Well the short answer is to not run such a command.
The long story is that it's part of the customization. Essentially there are two factors at play here. One is the fact that you are free to modify all files.
The second is that the rm command offers the helpful syntactic sugar to delete all files under a folder.
Effectively this could be restated as a singe simple tenet of Unix machines. Everything is a file. To make matters better, there are access controls, but there are overridden by your usage of
sudo
I guess you could add an alias or a function to ensure that this can never be run.
Well the short answer is to not run such a command.
The long story is that it's part of the customization. Essentially there are two factors at play here. One is the fact that you are free to modify all files.
The second is that the rm command offers the helpful syntactic sugar to delete all files under a folder.
Effectively this could be restated as a singe simple tenet of Unix machines. Everything is a file. To make matters better, there are access controls, but there are overridden by your usage of
sudo
I guess you could add an alias or a function to ensure that this can never be run.
answered 8 hours ago
HaoZekeHaoZeke
8113
8113
add a comment |
add a comment |
Be wary of using /* with the rm at all. It might be tedious to remove things one folder at a time, but remove all could create a tedious restore from backup. Because of course you backed up.
New contributor
Zach is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Linux Mint is not a “bad word” here, but simply off topic on this site, see the help center – if you have a question about your Linux Mint system, feel free to post it on a site where it’s on topic, e.g. Unix & Linux or the Linux Mint forums.
– dessert
54 mins ago
add a comment |
Be wary of using /* with the rm at all. It might be tedious to remove things one folder at a time, but remove all could create a tedious restore from backup. Because of course you backed up.
New contributor
Zach is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Linux Mint is not a “bad word” here, but simply off topic on this site, see the help center – if you have a question about your Linux Mint system, feel free to post it on a site where it’s on topic, e.g. Unix & Linux or the Linux Mint forums.
– dessert
54 mins ago
add a comment |
Be wary of using /* with the rm at all. It might be tedious to remove things one folder at a time, but remove all could create a tedious restore from backup. Because of course you backed up.
New contributor
Zach is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Be wary of using /* with the rm at all. It might be tedious to remove things one folder at a time, but remove all could create a tedious restore from backup. Because of course you backed up.
New contributor
Zach is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Zach is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 2 hours ago
ZachZach
13
13
New contributor
Zach is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Zach is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Zach is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Linux Mint is not a “bad word” here, but simply off topic on this site, see the help center – if you have a question about your Linux Mint system, feel free to post it on a site where it’s on topic, e.g. Unix & Linux or the Linux Mint forums.
– dessert
54 mins ago
add a comment |
Linux Mint is not a “bad word” here, but simply off topic on this site, see the help center – if you have a question about your Linux Mint system, feel free to post it on a site where it’s on topic, e.g. Unix & Linux or the Linux Mint forums.
– dessert
54 mins ago
Linux Mint is not a “bad word” here, but simply off topic on this site, see the help center – if you have a question about your Linux Mint system, feel free to post it on a site where it’s on topic, e.g. Unix & Linux or the Linux Mint forums.
– dessert
54 mins ago
Linux Mint is not a “bad word” here, but simply off topic on this site, see the help center – if you have a question about your Linux Mint system, feel free to post it on a site where it’s on topic, e.g. Unix & Linux or the Linux Mint forums.
– dessert
54 mins ago
add a comment |
Iliya Golik is a new contributor. Be nice, and check out our Code of Conduct.
Iliya Golik is a new contributor. Be nice, and check out our Code of Conduct.
Iliya Golik is a new contributor. Be nice, and check out our Code of Conduct.
Iliya Golik is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1117684%2fwhy-is-it-possible-to-delete-your-entire-file-system%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
16
That "confirmation" won't stop anyone. If you use
sudoin a terminal, you should know what you are doing. Period.– Pilot6
8 hours ago
1
@Pilot6 i'm not putting blame on anyone here, it is my fault i didn't know better, and i learned from my mistake, but there's other probably clueless people who could do this by accident, and nuke their entire system, they probably don't want that. a simple confirmation won't get in the way of anyone who actually wants to nuke their system while saving everyone else from a major mistake.
– Iliya Golik
8 hours ago
10
What was the point of using
-f? Without it you would get some warning, but it didn't stop you.– Pilot6
8 hours ago
9
-rfor recursive would be sufficient, no need to force. But as soon as you forced it, there is noone to blame. You need to learn what these options mean.– Pilot6
8 hours ago
5
"Why is it even possible to do that?" Why should't it be possible? There are perfectly good reasons to delete the contents of a directory hierarchy, and there are plenty of subsets of
/that would be nearly as bad to delete (/etc/, for example). It simply is not the job ofrmto decide which directories can or can't easily be deleted.– chepner
3 hours ago