2

I am in my flash directory

# cd /media/Flash/
# ls -al
drwxrwxr-x 10 root root 4096 Feb 22 14:35 .
drwxrwxr-x  7 root root 4096 Feb 20 15:57 ..
-rw-rw-r--  1 root root 2024 Feb 17 09:17 file1
-rw-rw-r--  1 root root  436 Feb 17 10:47 file2
drw-rw-r--  1 root root 2666 Feb 20 09:43

So:

How can I use cd command to go into the no name directory?

  • 4
    It's must have a name. printf '%s\n' [!f]* | od -t x2 to see what is it – cuonglm Feb 22 '16 at 11:09
  • 3
    Or, for a more human-readable output, try printf '%s\n' [!f]* | od -c or find . -type d -printf "'%f'\n". – terdon Feb 22 '16 at 11:13
  • 2
    The answer will depend on the actual name. Please edit your question and post the output of printf '%s\n' [!f]* | od -c. You can almost certainly cd into it by typing cd \ then hitting tab, but we need to see the output to give more precise instructions. – terdon Feb 22 '16 at 11:29
  • 2
    You could also try ls -l | hexdump -C to see what characters/bytes the dir name is made of. – Murphy Feb 22 '16 at 11:40
  • 1
    One of cd ? or cd ?? will likely work, assuming the directory name has less than three characters. ls -lq should tell you the numbers of characters. – jlliagre Feb 22 '16 at 13:00
1

Shell wildcard should expand to all of them, even this one. So you could do it by removing the rest of the contents and cd *, or by some more elaborate loop to check against the existing ones. I'm not sure what exactly that is, but x=$(ls | tail -n1) && cd "$x" could maybe work. It can't be an empty string, because that's not allowed by the filesystem.

Anyway, you should rename this thing as soon as possible into something normal. Try ls | hexdump to see what exactly is that thing (it could be any nonprintable character, or even something unicode that your terminal cannot display).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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