LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to delete non-empty directories? Also have a terminal question (https://www.linuxquestions.org/questions/linux-general-1/how-to-delete-non-empty-directories-also-have-a-terminal-question-342788/)

Nylex 07-13-2005 09:11 AM

How to delete non-empty directories? Also have a terminal question
 
Hi people, I have 2 problems here that I need help with.

1. I have a directory that I want to delete. Normally, I would just use this using Nautilus or something, but I'm having permission denied errors so I can't. The problem is, the directory isn't empty. It has other directories in it, which are probably not empty themselves (I haven't checked, there are quite a few). I tried

Code:

$ rmdir --ignore-fail-on-non-empty webmin-1.210
but this didn't seem to do anything. I then did

Code:

$ cd webmin-1.210
$ rm *

and that went through each file individually asking me if I wanted to delete. There were many files, so it goes without saying that this took a while! Of course, rm didn't delete the directories.

How then do I delete a directory and all its contents? I'm getting a bit confused by things in the man pages for rm and rmdir.

2. If I load GNOME or Xfce (and probably some of the other window managers I have installed, I haven't tried them all) and open a terminal, the prompt says "bash-3.00$". It wasn't always like this. If I load FVWM, the prompt says "nick@nick:~$" and that's what I used to have in GNOME. How do I get it back to that?

Any help appreciated, thanks.

mhallbiai 07-13-2005 09:26 AM

1. using forceful, recursive delete should clear up this problem
Code:

rm -rf webmin-1.210/*
if you also want to delete the webmin-1.210 directory drop the * (rm -rf webmin-1.210/)

2. not sure on this one so i will leave it to another ;)

hope this helps

Andrew Benton 07-13-2005 09:27 AM

rm -rf *

http://www-128.ibm.com/developerwork.../l-tip-prompt/

Nylex 07-13-2005 09:31 AM

Thanks both of you! :)

Diademed 07-13-2005 05:51 PM

Quote:

Originally posted by Andrew Benton
rm -rf *

http://www-128.ibm.com/developerwork.../l-tip-prompt/

Umm... Careful there....

Make sure you are in the correct directory when you issue that command.

Vgui 07-14-2005 12:55 AM

Your prompt is based on the PS1 variable, echo it to see what it is currently set at. You can export it from .bashrc, check out an online guide for the various syntax and coloring available for this.

Nylex 07-14-2005 01:17 AM

"echo PS1" gives me "\s-\v\$" in Xfce and "\u@\h:\w\$" and FVWM2. It's not that difficult to tell what they mean. Why is there a difference though? I use bash in both Xfce in FVWM2 :/. I don't have a .bashrc file, it isn't in my home directory (the only file in there relating to bash is .bash_history). Doing a "locate .bashrc" comes up empty too.

Thanks.

Vgui 07-14-2005 07:13 PM

When you are in the different window managers do you have different terminal prompts?
You might want to try creating the .bashrc file, putting in your export call, and seeing if it registers that each time you open a new terminal.
Basically though, you just need to export PS1 to what you want your terminal to be.

Nylex 07-14-2005 11:21 PM

Quote:

Originally posted by Vgui
When you are in the different window managers do you have different terminal prompts?
Yes.

Quote:

You might want to try creating the .bashrc file, putting in your export call, and seeing if it registers that each time you open a new terminal.
Basically though, you just need to export PS1 to what you want your terminal to be.

What does it look like?

Code:

EXPORT $PS1 = \u@\h:\w\$
Like that maybe? Perhaps with a semi-colon at the end too?

Thanks again.

Vgui 07-15-2005 06:40 PM

Code:

        #set terminal prompt
        export PS1='\e[0m[\#-\t] \w>\e[32m '

Replace as needed, but that should do the trick (or have an affect).

Nylex 07-15-2005 11:51 PM

Yep, it's ok now. Thanks a lot :D.


All times are GMT -5. The time now is 06:02 PM.