Search code examples
cygwin

Why does Cygwin's pathnames seem to be incorrect for executables?


I use the current version of Cygwin, 1.7.9-1.

When I typed "$ which python", Cygwin output "/usr/bin/python".

To confirm the root is the cygwin folder in my Windows 7 file system, I "cd /", and then "ls". The displayed result showed that the root is indeed the cygwin folder.

But the python executable is actually in the directory /bin. And there's no executable named "python" whatsoever in /usr/bin/python.

Why does Cygwin mistake /bin for /usr/bin? Thanks.

Update: I think my questions have been resolved. As a reference from cygwin.com, I've found this: "/usr/bin and /usr/lib are by default also automatic mount points generated by the Cygwin DLL similar to the way the root directory is evaluated. /usr/bin points to the directory the Cygwin DLL is installed in, /usr/lib is supposed to point to the /lib directory. This choice is safe and usually shouldn't be changed." http://www.cygwin.com/cygwin-ug-net/using.html

Update: Here's another good description: "Q: Why is C:\cygwin\usr\bin invisible from windows? A: Because it does not really exist. In cygwin, /usr/bin is just a link to /bin. E.g., if you "ls" the files in /usr/bin and in /bin, you will see identical files." http://cs.nyu.edu/~yap/prog/cygwin/FAQs.html#usrbin


Solution

    1. which outputs the path to executables which would have been executed were the command be run (i.e. executable on the PATH).
    2. By default only /usr/bin is placed on the PATH (/bin being the set of essential commands). See this question for more info.
    3. /bin (or rather C:\path\to\cygwin\bin) is mounted on /usr/bin.