Cygwin 安装:缺少 /usr/bin 和 /usr/local/sbin 目录

Cygwin installation: Missing /usr/bin and /usr/local/sbin directories

我有 Windows 7 台 64 位 PC。我刚刚在 c:\cygwin64 目录中安装了 Cygwin 最新版本 2.6.0。在安装过程中,我确保我选择了这些包:gcc-coremakeopensslsshvimemacsscpftp。安装成功完成。

现在我正在查看 c:\cygwin64 目录,我发现一些目录丢失了:

那么为什么缺少 /usr/bin/usr/local/sbin 目录?它们过时了吗?

谢谢

正如 Erik 所说,c:\cygwin64\usr\bin 在您的情况下确实是 c:\cygwin64\bin。至于 /usr/local/sbin/,可能不会从这些包中安装任何东西,所以它没有被创建。

根据 FAQ for the Cygwing directory structure

4.33. Why the weird directory structure? Why do /lib and /usr/lib (and /bin, /usr/bin) point to the same thing?

Why use mounts instead of symbolic links?

Can I use a disk root (e.g., C:) as Cygwin root? Why is this discouraged?

After a new installation in the default location, your mount points will look something like this:

 bash$ mount  
 C:\cygwin\bin on /usr/bin type ntfs (binary,auto)  
 C:\cygwin\lib on /usr/lib type ntfs (binary,auto)  
 C:\cygwin on / type ntfs (binary,auto)  
 C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)  

Note that /bin and /usr/bin point to the same location, as do /lib and /usr/lib. This is intentional, and you should not undo these mounts unless you really know what you are doing.

Various applications and packages may expect to be installed in /lib or /usr/lib (similarly /bin or /usr/bin). Rather than distinguish between them and try to keep track of them (possibly requiring the occasional duplication or symbolic link), it was decided to maintain only one actual directory, with equivalent ways to access it.

Symbolic links had been considered for this purpose, but were dismissed because they do not always work on Samba drives. Also, mounts are faster to process because no disk access is required to resolve them.

Note that non-cygwin applications will not observe Cygwin mounts (or symlinks for that matter). For example, if you use WinZip to unpack the tar distribution of a Cygwin package, it may not get installed to the correct Cygwin path. So don't do this!

It is strongly recommended not to make the Cygwin root directory the same as your drive's root directory, unless you know what you are doing and are prepared to deal with the consequences. It is generally easier to maintain the Cygwin hierarchy if it is isolated from, say, C:. For one thing, you avoid possible collisions with other (non-cygwin) applications that may create (for example) \bin and \lib directories. (Maybe you have nothing like that installed now, but who knows about things you might add in the future?)