Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This 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!


  Search this Thread
Old 11-16-2004, 09:37 AM   #1
Registered: Oct 2004
Posts: 65

Rep: Reputation: 15
Removing non empty directiories

I untarred source code which created a directory with a large number of subdiretories with files in them. Now I don't need this directory anymore and I'd like to remove it.

I know


will remove an empty directory, but won't touch it if there are other directories with files in it. Is there an easy way of removing the main directory with non-empty subdirectories in one or two easy commands, or am I stuck removing each file individually? Thanks
Old 11-16-2004, 09:40 AM   #2
Senior Member
Registered: Sep 2004
Location: Savannah, GA
Distribution: Ubuntu, Gentoo, Mythbuntu, ClarkConnect
Posts: 1,154

Rep: Reputation: 47
rm -rf

... the classic quote 'rm -rf /' = NEVER DO

=remove -recursivly, force (don't prompt)

Last edited by secesh; 11-16-2004 at 09:42 AM.
Old 11-16-2004, 10:25 AM   #3
Senior Member
Registered: Jan 2003
Location: Kansas City, Missouri, USA
Distribution: Ubuntu
Posts: 1,040

Rep: Reputation: 47
My favorite way to do this (and I do it a lot!) is to use Midnight Commander ("mc"), the file manager, probably either installed on your system or available for it.

It lets you see what you're dealing with and gives you a dialog box where you can choose to delete recursively or not.

Very, very handy. OK, it amounts to a GUI, but I think there are times when that's better than the command line. Just my preference.
Old 11-16-2004, 12:10 PM   #4
LQ Newbie
Registered: Nov 2004
Posts: 20

Rep: Reputation: 0
I like to rm -rf / all the time just for kicks!!!!!

Old 11-16-2004, 12:23 PM   #5
Registered: Nov 2004
Distribution: fedora core 3
Posts: 43

Rep: Reputation: 15
i use fedora core 1 and i tried to delete /mnt/fat32 so i did rm /mnt/fat32 and nothing. so i looked it up in my handy dandy linux+ cert prep book (it is what i use as a guide book) and i found that it wants you to use the rmdir command. so try that and see if it helps.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing non-empty directory satimis Linux From Scratch 5 03-09-2009 05:58 AM
Gentoo VNC, empty dialog box !! "Question" window is empty ! TheHushedCaskeT Linux - Software 0 02-01-2005 11:14 PM
How can I tell if a partition is empty? PenguinMolester Linux - Newbie 5 10-27-2004 08:46 AM
Removing files wihtout removing containing Direcotry caps_phisto Linux - General 2 10-07-2004 09:16 AM
Removing non-empty directories brunnopessoa Linux - Newbie 8 11-13-2003 08:56 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:37 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration