How do I tell whether my cygwin installation is 32 or 64 bit?

僤鯓⒐⒋嵵緔 提交于 2019-12-31 17:37:32

问题


How do I tell whether my cygwin installation is 32 or 64 bit? I don't remember which setup.exe to download. And I would hate to mess up my cygwin installation.


回答1:


uname -m

And it should say x86_64 in the output if it's 64-bit, or i686 if 32-bit.




回答2:


Run uname -m. If your cygwin install is 64-bit, the output will be x86_64. If it's 32-bit, you will instead see i386, i486, i586, or i686.




回答3:


The other answers address the OP's question, but if you're like me and use both flavors of Cygwin, it's useful to know which one you're using for more than just running setup.exe. If I know my script is running on Cygwin, I prefer

uname -m

because it gives me only "x86_64" or "i686" as output. I can use that in an "if" block like this:

if [ $(uname -m) == "x86_64" ]; then do something; fi

Of course, you can also use "uname -a" with "grep" in an if statement. It's a matter of personal preference.




回答4:


NateT gives the correct command to "print the machine hardware name" according to "uname --help":

uname -m

I get "x86_64" or "i686", but who knows whether those strings will change? Here's the entire output of "uname -a". The WOW64 tells you it's 32-bit Cygwin on 64-bit Windows. On 32-bit you've got no choice, right? ; - )

$ uname -a
CYGWIN_NT-6.1-WOW64 Pegasus 1.7.32(0.274/5/3) 2014-08-13 23:03 i686 Cygwin

Update: (Thanks to theDrake.) Ironically, since around Feb 2015 the WOW64 in the string has changed to WOW, so although checking for WOW is probably safe now it seems the "machine hardware name" might indeed be safer than the "kernel name".

Cygwin does seem to be take backwards compatibility seriously according to that thread, but also note that under MSYS2 you'd need to rely on the "machine hardware name" anyway and not the "kernel name":

$ uname -a
MSYS_NT-6.1 Pegasus 2.5.0(0.295/5/3) 2016-03-15 11:29 x86_64 Msys


来源:https://stackoverflow.com/questions/22687184/how-do-i-tell-whether-my-cygwin-installation-is-32-or-64-bit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!