LinuxQuestions.org
Visit Jeremy's Blog.
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 11-09-2003, 10:20 AM   #1
brunnopessoa
Member
 
Registered: Nov 2003
Location: Rio de Janeiro, Brazil
Distribution: Fedora
Posts: 67

Rep: Reputation: 15
Question Removing non-empty directories


Hello all!

I'm totally newbie in Linux world and have just installed Red Hat 9 in my machine. I am very excited to learn much more about this OS. I and some co-workers are supposed to install Linux in a machine we have in our company's marketing departament for file sharing purposes. I heard we must use Samba, since we will have clients running on Windows, right?!

First I am beginning with the Bash stuff, and I hope I can learn about C programming in Linux evironment too. I enjoy C and Java programmings.

Well... could you help me with my first doubt? I tried to delete a directory using rmdir <name of the directory>, but an error was displayed saying the dir is not empty. How can I delete a directory, even if it is not empty and either have sub-directories?

Thanks a lot!

Brunno

Last edited by brunnopessoa; 11-09-2003 at 11:50 AM.
 
Old 11-09-2003, 10:22 AM   #2
elp
Member
 
Registered: Aug 2003
Posts: 66

Rep: Reputation: 16
rm -rf
 
Old 11-09-2003, 10:30 AM   #3
brunnopessoa
Member
 
Registered: Nov 2003
Location: Rio de Janeiro, Brazil
Distribution: Fedora
Posts: 67

Original Poster
Rep: Reputation: 15
thanks a lot! it does work! =) ...but what are these options?

r goes recursively, it's fine. but i did not understande the force(f) option.

Last edited by brunnopessoa; 11-09-2003 at 10:45 AM.
 
Old 11-09-2003, 11:21 AM   #4
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 57
The -f(orce) option tells rm not to ask you for each file you want to delete. If you just use rm -r dirname you'll get prompted for each and every file in the directory and its subdirectories. Something really annoying, like this:
Code:
hw@baron:~/build$ rm -r wmpower-0.1.3/
rm: descend into directory `wmpower-0.1.3/'? y
rm: remove regular file `wmpower-0.1.3//Makefile'? y
rm: remove regular file `wmpower-0.1.3//LEGGIMI'? y
rm: remove regular file `wmpower-0.1.3//README'? y
rm: remove regular file `wmpower-0.1.3//fdl.txt'? y
etc, etc, etc, ad nauseum :P

Håkan
 
Old 11-09-2003, 11:54 AM   #5
brunnopessoa
Member
 
Registered: Nov 2003
Location: Rio de Janeiro, Brazil
Distribution: Fedora
Posts: 67

Original Poster
Rep: Reputation: 15
hardlinks & symlinks

clear, hw-tph, tks!

i am reading something about hardlinks to inodes and symlinks to file names. If I delete all hardlinks to an inode, this inode itselt is deleted automatically? is that the way it works?

Last edited by brunnopessoa; 11-09-2003 at 11:56 AM.
 
Old 11-09-2003, 11:59 AM   #6
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 194Reputation: 194
On a side note, when using rm -rf , you are telling your system to remove files without asking for a confirmation.

Example if you were root and did this:

rm -rf / home/user/blah.blah

Notice the space after / and home, if that was an accident, it would delete your whole system.

Just a thought and a note to be careful when using this command.
 
Old 11-09-2003, 12:09 PM   #7
brunnopessoa
Member
 
Registered: Nov 2003
Location: Rio de Janeiro, Brazil
Distribution: Fedora
Posts: 67

Original Poster
Rep: Reputation: 15
Oh gosh! really dangerous! trickykid, tks for your advice!

But if I am deleting the file itselt (you meant the inode?), so the links I have for this inode will be all broken?

Last edited by brunnopessoa; 11-09-2003 at 12:20 PM.
 
Old 11-11-2003, 10:51 AM   #8
Laptop2250
Member
 
Registered: Oct 2003
Posts: 131

Rep: Reputation: 15
haha!! thank you for your newbie question!! i searched found this thread and deleted a stupid folder i couldnt delete!! =) damn folder was annoying me!!
 
Old 11-13-2003, 07:56 PM   #9
r_jensen11
Senior Member
 
Registered: Apr 2003
Location: Minnesota, USA
Distribution: Slack 10.0 w/2.4.26
Posts: 1,032

Rep: Reputation: 45
you could also log in as root if it's for removing programs that you installed outside of the user's directory(Like Mozilla and the like...)
 
  


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
Removing non-empty directory satimis Linux From Scratch 5 03-09-2009 04:58 AM
finding empty directories with bash Iriel Solaris / OpenSolaris 2 09-15-2005 12:52 PM
Removing non empty directiories tolstyi Linux - Newbie 4 11-16-2004 11:23 AM
how do I remove all empty directories? noisybastard Linux - General 2 08-10-2003 11:47 PM
finding empty directories... PokerFace Linux - General 2 10-16-2002 08:23 AM


All times are GMT -5. The time now is 01:39 PM.

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