Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have created a folder in my file system called "opt". It contains two other folders. How do I delete it with signing in as a root user? Thanks

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

Open terminal - Type this command and hit enter key

sudo gksu nautilus

Now, enter your password, After you can go to "opt" directory and delete it

share|improve this answer
    
Awesome awesome...... i just killed the file. You deserve a cup of coffee. Thanks –  user179944 Aug 1 '13 at 14:34
    
@user179944 if this answers your question, please mark it as accepted. –  terdon Aug 1 '13 at 14:49
add comment

rmdir will not work here as it will only remove empty directories

use rm with some additional flags

rm -r will recurse and delete everything in the folder

rm -f will force the removal of a directory. rm is not for removing directories

put these together and your command should be rm -rf /path/to/opt

Depending on the permissions of the folder you might need to use sudo rm -rf /path/to/opt

Check out man rm to get some extra info.

share|improve this answer
1  
As on the other answer: I would suggest that it'd be (slightly) safer to use the full path to this folder, i.e. rm -rf /path/to/opt. You really don't want to risk removing /opt. –  Jez W Aug 1 '13 at 14:21
    
Oh yeah, Good call. –  dan08 Aug 1 '13 at 14:25
    
I've used this and it wouldn't work. I have had to do it from inside the "opt" folder too. This folder "java" and "spotify" inside them. The java one has "64" in it while 64 has "jre1.7.0_25" in it. Thanks –  user179944 Aug 1 '13 at 14:32
    
Im curious why this didn't work. What error did you get? –  dan08 Aug 1 '13 at 14:47
add comment

If you didn't create it as root, rm -r opt should work. Otherwise, try sudo rm -r opt.

share|improve this answer
    
I would suggest that it'd be (slightly) safer to use the full path to this folder, i.e. rm -r /path/to/opt. You really don't want to risk removing /opt. –  Jez W Aug 1 '13 at 14:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.