Review your favorite Linux distribution.
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 05-23-2013, 09:52 PM   #1
Registered: Oct 2008
Posts: 91

Rep: Reputation: 0
deleting nonempty directories

Is there a way to delete a non-empty directory with subdirectories? I know I can send to trash in a GUI but would like to do it from the terminal interface.
Old 05-23-2013, 09:58 PM   #2
Senior Member
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 4,539

Rep: Reputation: 1419Reputation: 1419Reputation: 1419Reputation: 1419Reputation: 1419Reputation: 1419Reputation: 1419Reputation: 1419Reputation: 1419Reputation: 1419
Use the rm command with -rf options
rm -rf <non-empty directory>
1 members found this post helpful.
Old 05-23-2013, 10:14 PM   #3
Senior Member
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Originally Posted by allend View Post
Use the rm command with -rf options
I think it's better to go through the manual of rm (see here), so you can use other command line options as well like -i for interactive remove i.e. it will ask you before deletion of the directory.
~$ rm -rfi /path/to/directory
Just take a note, that rm -rf is very dengerous command and it's wrong use may destroy your system in seconds, so invoke it with caution.
4 members found this post helpful.


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
Deleting directories sectore Linux From Scratch 1 04-10-2009 02:16 PM
Deleting directories NomadABC Linux - Newbie 2 02-10-2005 02:11 PM
rm command - deleting directories Micro420 Linux - Newbie 11 11-02-2003 02:18 PM
Deleting Directories J_Bone Linux - Newbie 4 08-17-2003 04:19 PM
deleting directories AZDAVE Linux - Newbie 1 08-15-2003 10:05 AM

All times are GMT -5. The time now is 09:51 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