1

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.

  • 1
    What exactly do you add after the "rm"? – Paul Woitaschek May 21 '12 at 00: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 01: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 02: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 04:17

2 Answers2

5

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!

Tomas
  • 1,069
  • +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 00: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 01:19
  • haven't tried the double quotes, i will give that a try. – pewterss May 21 '12 at 01:58
  • oh yeah, the double quotes worked like a charm, thanks guys. – pewterss May 21 '12 at 02: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. –  May 21 '12 at 02:12
0

I had the similar issue that you had - i had 2 directories "push_apk_to Playstore/" & push_apk_to_Playstore/ , & i had to delete the directory push_apk_to Playstore/ I finally resolved the issue by applying a statement sudo rm -rf push_apk_to\ Playstore which successfully deleted the directory containing space .

sambit
  • 111