Shell Judge Linux System 32-bit or 64-bit command

Source: Internet
Author: User

In the previous article introduced the Shell to judge the various versions of Debian methods, in the actual use, the judge system is 32-bit or 64-bit is often used, today to introduce the content.

Manually view the number of system digits

To view the number of Linux system digits, you can perform the following two commands individually

Getconf Word_bit

Used to get the number of digits in Word

Getconf Long_bit

The number of digits used to get long

For 64-bit systems above two commands should be 32 and 64 respectively.

To determine whether the Linux system is 32-bit or 64-bit has a lot of methods, recommended with getconf, however, some people think getconf word_bit=32 is 32bit,getconf word_bit=64 is 64bit, please go to 64bit machine execution, hehe. Getconf word_bit Show results or 32,why?

In a 32-bit system, the int and long types are typically 4 bytes, and the 64-bit system is of type int or 4 bytes, but long has become a 8-byte inux system that can be
Use "getconf word_bit" and "getconf long_bit" to get the digits of WORD and LONG


Shell determines the number of digits in the system

Ldconfig
If [$ (getconf word_bit) = ' $ '] && [$ (getconf long_bit) = ' 64 ']; Then
Ln-s/usr/local/mysql/lib/mysql/usr/lib64/mysql
Else
Ln-s/usr/local/mysql/lib/mysql/usr/lib/mysql
Fi

Add some other way

Uname-a

32 bits: Linux localhost.localdomain 2.6.32-431.17.1.el6.i686 #1 SMP Wed May 7 20:52:21 UTC 2014 i686 i686 i386 gnu/linux

64 bits: Linux demolinux 2.6.32-431.11.2.el6.x86_64 #1 SMP Tue Mar 19:59:55 UTC 2014 x86_64 x86_64 x86_64 gnu/linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.