alex_wang
alex_wang

Reputation: 209

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

Upvotes: 3

Views: 982

Answers (2)

dm3
dm3

Reputation: 2058

  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.

Upvotes: 3

Keith Thompson
Keith Thompson

Reputation: 263257

Hmm, your Cygwin setup must be different than mine.

On my system, /usr/bin and /bin are actually the same directory; df shows that C:/cygwin/bin is actually mounted as /usr/bin. So of course /bin/python.exe and /usr/bin/python.exe exist and are the same file (which can also be referred to as /bin/python and /usr/bin/python).

How up to date is your Cygwin? Are you sure there's no /usr/bin/python or /usr/bin/python.exe?

Upvotes: 2

Related Questions