Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

crtvmac

Guest
Original poster
Aug 14, 2009
85
0
I am having a problem getting into my directories from the Terminal window using Mac. When I type ls -F, I get a list of my directory's with the / before the directories. Then I type cd and the name of the directory I am trying to get into. When I do that command, i keep getting "-bash: cd: Java: Not a Directory" or "No such file or directory". Will someone tell me what I am doing to not be able to get into any of my directories?
 
I'm not sure if bash changed that much from 10.5 to 10.6, but that is not the error message I get:

file1: Not a directory.
or
file: No such file or directory.


Can you give an example of a directory name from your ls command and what you are passing to the cd command?
 
Are there spaces or other whitespace in the directory names?

If so, you need to escape them either with backslashes or quotes.

I always find the easy way is to use tab completion.

i.e. type cd and if you want to go to folder "Java Code" type J then tab until the right name is shown.

B
 
I'm not sure if bash changed that much from 10.5 to 10.6, but that is not the error message I get:

file1: Not a directory.
or
file: No such file or directory.


Can you give an example of a directory name from your ls command and what you are passing to the cd command?

I'm running 10.6.2.
Example from 'ls' command: 'Java Learning/'
Example from 'cd' command: 'cd Java Learning'
 
I'm running 10.6.2.
Example from 'ls' command: 'Java Learning/'
Example from 'cd' command: 'cd Java Learning'

It is a space issue most likely.

As the suggestion above says, type the cd command and the first word of the folder name then hit the ESC key twice/or hit TAB once, it will auto complete for you. You will see that it uses some escape characters.

You can also use " quotes around the name.

Edit: Tab completion and ESC both work.
 
If you choose not to use command line completion you just need to wrap it in quotes yourself.

cd "Java Learning"/

or

cd Java\ Learning/

EDIT: you learn something new everyday. I didn't realize you could use either single or double quotes and double ESC instead of TAB.

B
 
Are there spaces or other whitespace in the directory names?

If so, you need to escape them either with backslashes or quotes.

I always find the easy way is to use tab completion.

i.e. type cd and if you want to go to folder "Java Code" type J then tab until the right name is shown.

B

I used the quotes as you suggested and was able to get into my selected directory. Thank you for the assistance.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.