Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
depending on how your distro aliased your rm command, it may ask you if you want to descend down the directory and subdirectories and prompt you if you want to delete all the files inside the parent directory including the subdirectories. if you're totally sure (rm can be dangerous), you can use instead:
rm -rf <directory name>
that will just delete the directory and everything in it without prompting you (again can be dangerous).
rm -f cannot be used to remove directories, u wud have to use the recurse option (-r) to remove directries. If that does not help then use the force option along with it.
e.g rm -rf
man rm shud be able to tell u more w.r.t to ur distro..
If you do, you will reinstall. After you stop and and .
Be careful now ya here.
Later
well as root anyway. as a user, you may lose something like /tmp or some other write-accessible-to-all-user files and directories. but yes rm with the force flag and/or the recurse flag is dangerous.
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986
Original Poster
Rep:
What the heck?? this is confusing! First someone tells me to do rm -rf, and then another user says that I will lose everything and may have to reinstall?
Let's say that I didn't read the warning before hand and actually type rm -rf. What if I lost everything? Man, I would be SO pissed. I'm kind of upset that someone would give out a dangerous command like this if it could easily and potentially force me to reinstall Mandrake.
I think I'll forget the console since it seems dangerous and stick with just deleting via KDE. I just wanted to see if I could make my way around the console, but apparently it sounds like a bomb waiting to go off.
Originally posted by Micro420 What the heck?? this is confusing! First someone tells me to do rm -rf, and then another user says that I will lose everything and may have to reinstall?
Let's say that I didn't read the warning before hand and actually type rm -rf. What if I lost everything? Man, I would be SO pissed. I'm kind of upset that someone would give out a dangerous command like this if it could easily and potentially force me to reinstall Mandrake.
I think I'll forget the console since it seems dangerous and stick with just deleting via KDE. I just wanted to see if I could make my way around the console, but apparently it sounds like a bomb waiting to go off.
Thank God for drag-n-drop in the trash can icon.
no,
rm -rf /
will delete all your linux installation if you do it as root. / is the parent directory of everything. it's just a warning that using rm -rf can be dangerous. especially using rm -rf over the sytem directories. a single misspelling will spell disaster. for instance, what if you just want to delete a directory in /tmp called tmp that was owned by root? as root, you'd use:
rm -rf /tmp/tmp
what if you "misspelled" the directory adding a space after the first "/"
rm -rf / tmp/tmp
this is bad. since rm can remove multiple files. to rm it looks like you want to delete "/" and some directory called "tmp/tmp". well it will delete "/" first. whoops! reinstall time.
just be careful using rm -rf. but the command to remove a directory is still:
Well if you are not carefull you can type it in wrong in windoze. I did that once.
The one I posted is the WRONG way. It deletes everything, if you are logged in as root.
The ones they gave should delete the directory you want and nothing else.
I do what you did, I put it in the trash can and wait a while before I empty. If I need it, at least I know where it is.
Sorry if I confused you. I just didn't want you to type it wrong and say you didn't know. Sometimes it's not knowing what to do, but knowing what not to do.
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986
Original Poster
Rep:
Quote:
Originally posted by dalek Well if you are not carefull you can type it in wrong in windoze. I did that once.
The one I posted is the WRONG way. It deletes everything, if you are logged in as root.
The ones they gave should delete the directory you want and nothing else.
I do what you did, I put it in the trash can and wait a while before I empty. If I need it, at least I know where it is.
Sorry if I confused you. I just didn't want you to type it wrong and say you didn't know. Sometimes it's not knowing what to do, but knowing what not to do.
Later
I still don't understand why I can't just type 'rm <directory name>' and it's gone. Why all these weird '-rf' marks???
In MS-DOS, it was just 'del <directory>' or 'deltree <directory>'.
I don't see how MS-DOS was dangerous unless you used the command 'format'. I guess my ignorance with the linux console is making me be extra cautious now.
Originally posted by Micro420 I still don't understand why I can't just type 'rm <directory name>' and it's gone. Why all these weird '-rf' marks???
In MS-DOS, it was just 'del <directory>' or 'deltree <directory>'.
I don't see how MS-DOS was dangerous unless you used the command 'format'. I guess my ignorance with the linux console is making me be extra cautious now.
deltree /y c:\
is dangerous. rm -rf / is just as dangerous.
-rf means that you rm will recurse down the parent directory and all subdirectories and delete all the files, subdirectories, and the parent directory without prompting.
the -r is the same thing as calling deltree and the -f is the same thing /y. but instead of calling a new function, deltree, you use flags on one command, rm.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.