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.

So I finally got my Ubuntu box up and running, ran the LAMP install, and successfully loaded up the apache2 webserver, and php5. The one thing I didn't want is for Ubuntu during the installation to take one whole 1TB drive that contained a ton of stuff, but it was a backup drive so no biggie. But now I was transferring pics to the /var/www location and it copied a directory that contains spaces. Terminal seems to hang when I use the rm command, any ideas would be appreciated, thanks guys.

share|improve this question
1  
What exactly do you add after the "rm"? –  wegsehen May 21 '12 at 0:02
    
usually after the rm i enter angelo's Pictures, then i tried Angelo's\Pictures, and the terminal just went to a area where i could type in, hit enter but nothing would ever happend after that, and it stayed that way until I closed the terminal window. –  pewterss May 21 '12 at 1:57
    
Forgot to add I had to enter the root password since i used sudo... i just used the rm -r and double quotes and that did the trick. Thanks for your response as well. –  pewterss May 21 '12 at 2:04
    
Ah, then I think I know what the problem was in the first place: the single quote in Angelo's is not seen as a character in the file name but as a special character. I bet that if you tried Angelo\'s\ Pictures it'll work. –  Tomas May 21 '12 at 4:17

1 Answer 1

up vote 3 down vote accepted

Your terminal hangs, that's very odd. In the terminal I'm usually able to remove spaces by escaping the space character with a backslash:

rm -r test\ dir

If that doesn't work, have you tried enclosing it in single or double quotes:

rm -r "test dir" or rm -r 'test dir'

Another idea would be to install a terminal file manager such as Midnight Commander and try to remove the file that way. Good luck!

share|improve this answer
    
+1 but... rm dirpath -r works although it is undocumented, is at variance with the standard unix command -options file ... convention and just looks weird. It's probably better to keep to the standard habit. For example awk /etc/passwd -F: '{print $1}' yields an error (even though cat /etc/motd -E works). –  msw May 21 '12 at 0:40
    
Good call. The problem you mention seems not to exist for rm -r. I'll change my answer to make it a bit more neat. –  Tomas May 21 '12 at 1:19
    
haven't tried the double quotes, i will give that a try. –  pewterss May 21 '12 at 1:58
    
oh yeah, the double quotes worked like a charm, thanks guys. –  pewterss May 21 '12 at 2:03
    
Also you can press Esc or tab to match files. If you enter the start of the name and hit either, it will auto-match the remainder. –  gecko May 21 '12 at 2:12

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.