Why does ls ~ / .ssh work but not cd ~ / .ssh?

If the ls displays the contents of a directory, then some output in ls <directory would seem to indicate the existence of a directory.

For example, this is what I get:

 > ls ~/.ssh id_rsa id_rsa.pub known_hosts 

But why then when I type cd ~/.ssh I get

 > cd ~/.ssh The system cannot find the path specified. 

?

Why can I list the contents of this directory but not jump to it?

I am using windows 8

+5
source share
1 answer

This answer is based on the assumption that you are using the command line to execute these commands.

The reason that you can ls directory, but not cd to it, is because the ls comes from a library you loaded that does ls work on windows.

In contrast, your cd is executed from Windows, not from the library you downloaded.

In short, ls knows how to parse a tilde ( ~ ) at home, but windows can't parse ~ . try: cd ~ . it will not work.

+6
source

All Articles