Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can not seem to rm -r or even cd into a directory that clearly exist but I get the error No such file or directory. What's going on? Relevant commands below. Should I force this or what? I would like to know why this is happening as well.

root@jaxsin:/var/www/camwright/core/components/databackup/dumps# ls -al
total 24
drwxr-xr-x 2 root     root     4096 Aug 30 11:19  modx_camwright_2013_08_30__1377875941
drwxr-xr-x 2 root     root     4096 Aug 30 11:20  modx_camwright_2013_08_30__1377876001
drwxr-xr-x 2 root     root     4096 Aug 30 11:21  modx_camwright_2013_08_30__1377876062
drwxr-xr-x 5 www-data www-data 4096 Aug 30 11:21 .
drwxr-xr-x 7 www-data www-data 4096 Aug 30 10:45 ..
-rw-r--r-- 1 www-data www-data   21 Aug 30 10:45 readme.txt

root@jaxsin:/var/www/camwright/core/components/databackup/dumps# cd modx_camwright_2013_08_30__1377875941/
-su: cd: modx_camwright_2013_08_30__1377875941/: No such file or directory

root@jaxsin:/var/www/camwright/core/components/databackup/dumps# rm -r modx_camwright_2013_08_30__1377875941/
rm: cannot remove `modx_camwright_2013_08_30__1377875941/': No such file or directory
share|improve this question
Edit your question to show the output of ls -Al modx_camwright_2013_08_30__1377875941. My guess is those directories are very shortlived. – guntbert Aug 30 '13 at 16:47
up vote 8 down vote accepted

The modx_camwright directories' names appear to start with a space. If you look closely, you'll see that the letter m appears farther to the right on the line, than the names of the other entries. Furthermore, they are listed before entries that start with ., which is a clue that they do not start with any letter. (After all, readme.txt is "alphabetized" after the . and .. directories.)

Or it could be some other weird character that ls shows as a space.

So, instead of calling the directory modx_camwright_2013_08_30__1377875941, call it:

' modx_camwright_2013_08_30__1377875941'

To cd to it, run:

cd ' modx_camwright_2013_08_30__1377875941'

To remove it and all its contents, run:

rm -r ' modx_camwright_2013_08_30__1377875941'

If those commands don't work, maybe the character at the beginning isn't a space. (It probably is--most other whitespace characters are shown as ?s by ls.)

You can use ? to match a single character. So, you can try calling this directory by the name:


(Don't use quotes.)

Or if it's multiple characters, you can use *, which matches zero or more characters:


(Don't use quotes for that either.)

Most likely, just quoting the name and adding a space to the beginning (as described above) will work.

share|improve this answer
Nice catch Eliah! – hakermania Aug 30 '13 at 15:59
Indeed a nice one! – Braiam Aug 31 '13 at 22:33

Your Answer


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.