PDA

View Full Version : [ubuntu] deleting directorys



xletswinx
July 26th, 2010, 06:13 PM
How do i remove directorys off of ubuntu?

linux18
July 26th, 2010, 06:16 PM
right click and delete OR
rm -r "directory"

KdotJ
July 26th, 2010, 08:55 PM
rm -r "directory"

Just as a word of warning, but VERY careful when using such commands. Commands featuring


rm -r ......

and


rm -rf ......

can be very dangerous, and infact just wipe out all data without asking if used incorrectly. As a break down, the code "rm" means remove, the flag "-r" means recursively so it will go through all sub-directories too. and the flag "-f" means force, which will do things without your confirmation.

Just be warned.

linux18
July 26th, 2010, 09:28 PM
Just as a word of warning, but VERY careful when using such commands. Commands featuring



and



can be very dangerous, and infact just wipe out all data without asking if used incorrectly. As a break down, the code "rm" means remove, the flag "-r" means recursively so it will go through all sub-directories too. and the flag "-f" means force, which will do things without your confirmation.

Just be warned.
" sudo rm -rf / " no longer makes your computer disintergrate, it just gives you the message " cannot remove root directory " try it in virtualbox if you don't believe me, that kind of malicious command has been secured long ago. just saying

Zeike
July 26th, 2010, 10:12 PM
" sudo rm -rf / " no longer makes your computer disintergrate, it just gives you the message " cannot remove root directory " try it in virtualbox if you don't believe me, that kind of malicious command has been secured long ago. just saying

Just because you can't 'rm -rf /' doesnt mean you can't still screw things up with the rm command.

linux18
July 26th, 2010, 10:19 PM
Just because you can't 'rm -rf /' doesnt mean you can't still screw things up with the rm command.
true

KdotJ
July 27th, 2010, 02:23 AM
" sudo rm -rf / " no longer makes your computer disintergrate, it just gives you the message " cannot remove root directory " try it in virtualbox if you don't believe me, that kind of malicious command has been secured long ago. just saying

True, but how about when we're not talking about the root directory? For example, let's say you have a folder in your home folder called "dir1" and you want to recursively remove it.

You use the command:


rm -rf /home/user/dir1

that will be fine, and will give the result you're after.
But let's say, by accident you add a space in there like so:


rm -rf /home/user/ dir1

This command above will wipe your entire home folder, along with dir1. Everything gone. So for the root directory yes it's now safe perhaps to an extent, but still worth mentioning the power of this command to new people