LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
LinkBack Search this Thread
Old 08-24-2005, 12:01 AM   #1
STAGED
LQ Newbie
 
Registered: Jun 2005
Location: Agoura Hills, CA
Distribution: FC3
Posts: 17

Rep: Reputation: 0
deleting directory w/o descending


how do i delete a directory without descending and having to delete every content inside. i tried doing 'prompt' and 'rm -r' but to no avail.

thanks
 
Old 08-24-2005, 12:22 AM   #2
newinlinux
Member
 
Registered: Dec 2003
Location: Next to Equator
Distribution: GNU/Linux 2.6.14
Posts: 382

Rep: Reputation: 30
you can add a f to rm -r becoming rm -rf
 
Old 08-24-2005, 12:33 AM   #3
aeruzcar
Member
 
Registered: Jul 2003
Location: Santiago, Chile
Distribution: Gentoo
Posts: 282

Rep: Reputation: 30
It is weird that rm -r does not just work, as newinlinux said try with rm -rf
 
Old 08-24-2005, 01:35 AM   #4
dalek
Senior Member
 
Registered: Jul 2003
Location: Mississippi USA
Distribution: Gentoo
Posts: 2,058
Blog Entries: 2

Rep: Reputation: 65
Make SURE you type that in right, especially if you are root. It does not ask questions about what you are doing.

I had moved my Gentoo to a new hard drive and I booted the old drive and typed in rm -rf /* just to see what it would do. It ran until it deleted something that it needed then errored out. About 90% of the files were gone, I think it was something in /usr/sbin. Trust me, it will delete what you tell it, even if you tell it wrong.

Later

 
Old 08-24-2005, 07:46 AM   #5
doc.nice
Member
 
Registered: Oct 2004
Location: Germany
Distribution: Debian
Posts: 274

Rep: Reputation: 34
<info>
some distros do an alias rm="rm -i" as default, for new users coming from windows...

normally these are in /etc/tcshrc.alias or /etc/profile or /etc/bashrc or whatever shell is in use...
</info>
 
Old 08-24-2005, 08:39 AM   #6
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,770
Blog Entries: 4

Rep: Reputation: 697Reputation: 697Reputation: 697Reputation: 697Reputation: 697Reputation: 697
rm -r alone doesn't work because by default rm doesn't remove directories - only their contents and tells you it can't remove a directory because it is a directory. The -f flag says to disregard all warning conditions and force the remove.

As pointed out by others it is useful for removing an entire directory tree but can be very dangerous if you don't use it correctly.
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting a Directory using c++ in Linux ArulPrabhuT Programming 11 08-20-2011 11:10 AM
"WARNING: Circular directory structure" error when deleting directory pistonbrew Linux - Software 5 02-03-2005 06:05 AM
deleting old /usr directory after a move... jimieee Linux - General 2 12-26-2003 05:15 PM
Deleting a directory... closet geek Linux - General 7 07-09-2003 06:25 AM
deleting non-empty directory sadiboyz Linux - Newbie 2 04-21-2003 09:29 PM


All times are GMT -5. The time now is 11:14 AM.

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