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.
Asked
Active
Viewed 1.6k times
2 Answers
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 unixcommand -options file ...
convention and just looks weird. It's probably better to keep to the standard habit. For exampleawk /etc/passwd -F: '{print $1}'
yields an error (even thoughcat /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 -
-
-
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
Angelo's
is not seen as a character in the file name but as a special character. I bet that if you triedAngelo\'s\ Pictures
it'll work. – Tomas May 21 '12 at 04:17