Find linux x86 or x64

How to determine whether a given Linux is 32 bit or 64 bit?

How can I know from this that the given OS is 32 or 64 bit? This is useful when writing configure scripts, for example: what architecture am I building for?

21 Answers 21

Try uname -m . Which is short of uname —machine and it outputs:

x86_64 ==> 64-bit kernel i686 ==> 32-bit kernel 

Otherwise, not for the Linux kernel, but for the CPU, you type:

Under «flags» parameter, you will see various values: see «What do the flags in /proc/cpuinfo mean?» Among them, one is named lm : Long Mode (x86-64: amd64, also known as Intel 64, i.e. 64-bit capable)

Or using lshw (as mentioned below by Rolf of Saxony), without sudo (just for grepping the cpu width):

lshw -class cpu|grep "^ width"|uniq|awk '' 

Note: you can have a 64-bit CPU with a 32-bit kernel installed.
(as ysdx mentions in his/her own answer, «Nowadays, a system can be multiarch so it does not make sense anyway. You might want to find the default target of the compiler»)

grep flags /proc/cpuinfo only tells you wether the CPU is 64bit. As I understand the question it was about the OS. uname -m only tells me «i686».

I have a 32 bit kernel on 64 bit hardware and get «x86_64» from ‘uname -m’ (on Debian). The man page for uname says that -m shows the machine hardware name, so that seems correct.

If I have a 32-bit kernel running on a 64-bit machine/ processor, what would uname -i , uname -p and uname -m show?

@JavierNovoaC. tm (Thermal Monitor) indicates Automatic clock control. It has nothing to do with distinguishing a 32-bit processor. In fact, lm (long mode) is present if and only if you have a 64-bit CPU. So that’s why you should only rely on lm. otherwise the answer given by Thomas Watnedal is the best. This answer is just wrong and has misled many people plz moderators do something about it.

If you were running a 64 bit platform you would see x86_64 or something very similar in the output from uname -a

To get your specific machine hardware name run

which returns either 32 or 64

That means the CPU is 64-bit, but you’ve only installed a 32-bit operating system upon it, even though you could have used a 64-bit one.

Steve Kemp is right, so be careful (Mac OS X 10.5 on 2009 MacBooks comes to mind, where the OS is 32-bit but its capable of running 64-bit apps)

The uname -m is not useful for the QP’s configure as it can give the wrong result. The getconf LONG_BIT get the default bit size of the C library which may not be the correct size for a specified, by CC , compiler.

getconf LONG_BIT may provide 32 ig it has been built as a 32 bit application (typically 64 bit kernel running a 32 bit userland).

Читайте также:  Boot failed kali linux

lscpu will list out these among other information regarding your CPU:

Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit . 

Outputs the physical capabilities of the CPU, useful, but not reliable for the current userspace of the current OS.

Totaly wrong. The question is what OS is running. 42 upvotes? I would spend a down vote but it would drown.

Another useful command for easy determination is as below:

I guess it all depends on what the questioner means by «64-bit» — it used to mean the natural size of integers, but it’s now often used to mean the addressing size instead.

but is twice as fast to type

This returns the process types that the kernel can support. It is possible and even reasonable to run a 32 bit userspace on a 64bit kernel.

I was wondering about this specifically for building software in Debian (the installed Debian system can be a 32-bit version with a 32 bit kernel, libraries, etc., or it can be a 64-bit version with stuff compiled for the 64-bit rather than 32-bit compatibility mode).

Debian packages themselves need to know what architecture they are for (of course) when they actually create the package with all of its metadata, including platform architecture, so there is a packaging tool that outputs it for other packaging tools and scripts to use, called dpkg-architecture. It includes both what it’s configured to build for, as well as the current host. (Normally these are the same though.) Example output on a 64-bit machine:

DEB_BUILD_ARCH=amd64 DEB_BUILD_ARCH_OS=linux DEB_BUILD_ARCH_CPU=amd64 DEB_BUILD_GNU_CPU=x86_64 DEB_BUILD_GNU_SYSTEM=linux-gnu DEB_BUILD_GNU_TYPE=x86_64-linux-gnu DEB_HOST_ARCH=amd64 DEB_HOST_ARCH_OS=linux DEB_HOST_ARCH_CPU=amd64 DEB_HOST_GNU_CPU=x86_64 DEB_HOST_GNU_SYSTEM=linux-gnu DEB_HOST_GNU_TYPE=x86_64-linux-gnu 

You can print just one of those variables or do a test against their values with command line options to dpkg-architecture.

I have no idea how dpkg-architecture deduces the architecture, but you could look at its documentation or source code (dpkg-architecture and much of the dpkg system in general are Perl).

Источник

5 Command Line Ways to Find Out Linux System is 32-bit or 64-bit

This tutorial describes how to find out whether your Linux system’s OS is 32-bit or 64-bit. This will be helpful if you wanted to download or install an application in your Linux system. As we all know, we can’t install 64-bit applications into a 32-bit OS type. That’s why knowing your Linux system’s OS type is important.

Check Linux System is 32-bit or 64-bit

Here are the five easy and simple methods to verify your Linux system’s OS type. It doesn’t matter whether you’re using a GUI or CLI type systems, the following commands will work on almost all Linux operating systems such as RHEL, CentOS, Fedora, Scientific Linux, Debian, Ubuntu, Linux Mint, openSUSE etc.

1. uname Command

uname -a command will display your Linux system’s OS type. This is the universal command and it will work on almost all Linux/Unix operating systems.

To find out the system’s OS type, run:

$ uname -a Linux tecmint.com 3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

2. dpkg Command

dpkg command will also display whether your Debian/Ubuntu operating system is 32-bit or 64-bit. This command will work only on Debian and Ubuntu based distributions and it’s derivatives.

Open your Terminal, and run:

$ dpkg --print-architecture 

If your OS is 64-bit, you’ll get the following output:

Читайте также:  Команда top linux выйти

If your OS is 32-bit, then the output will be:

3. getconf Command

getconf command will also display the system configuration variables. Now, let me show you how to find out the Linux system arch using getconf command.

$ getconf LONG_BIT 64

For more details refer the man pages.

4. arch Command

arch command will display your OS type. This command is similar to uname -m command. If its output is x86_64 then it’s 64-bit OS. If the output is i686 or i386, then it’s 32-bit OS.

5. file Command

file command with with a special argument /sbin/init will display the OS type.

$ file /sbin/init /sbin/init: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=7a4c688d009fc1f06ffc692f5f42ab09e68582b2, stripped

Conclusion

You now know the ways to find out your Linux operating system’s type. Of course, there are few other ways to find out the OS type, but these are the often and pragmatic methods so far. If you know any other commands or methods to display the OS type, feel free to let us know in the comments section below.

A Linux Consultant, living in India. He loves very much to write about Linux, Open Source, Computers and Internet. Apart from that, He’d like to review Internet tools and web services.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Delete Huge Files in Linux

Parted Command in Linux

TLDR Man Pages for Linux Commands

apt-get Command Examples

Ubuntu apt-cache Commands

apt Command Examples

11 thoughts on “5 Command Line Ways to Find Out Linux System is 32-bit or 64-bit”

I’d just like to interject for a moment. What you’re referring to as Linux, is in fact, GNU/Linux, or as I’ve recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX. Many computer users run a modified version of the GNU system every day, without realizing it. Through a peculiar turn of events, the version of GNU which is widely used today is often called “Linux”, and many of its users are not aware that it is basically the GNU system, developed by the GNU Project. There really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine’s resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the GNU operating system: the whole system is basically GNU with Linux added, or GNU/Linux. All the so-called “Linux” distributions are really distributions of GNU/Linux. Reply

Great post! You can also check using a environment variable: echo $HOSTTYPE Result: i386 -> 32 bits
x86_64 -> 64 bits Reply

Источник

How to find architecture of my PC and Ubuntu?

Can someone please explain to me why both i386 & i686 ? What exactly is my PC architecture and what version of Ubuntu am I using (32bit or 64bit)?

is this a complete output from uname -a? I assume some fields like the kernel-name, kernel-version etc are missing.

Читайте также:  Convert linux все файлы

5 Answers 5

Open a terminal try using uname -m command. This should show you the OS architecture.

If it gives any output like ix86 , where x is 3,4,5 or 6, Your OS is 32bit.

You can also see the Ubuntu architecture by Opening «System monitor» and going in the System tab.

enter image description here

Difference between hardware platform and Processor type:

There is a difference between the hardware platform (which is given by -i switch) to the CPU type (given by -p switch).

The hardware platform tells us which architecture the kernel is built for (may be optimized though for later versions). It can be a i386.

However the Processor type refers to the actual processor type of your machine such as i686 (P4 and later builds).

Thanks to Schotty of this this page. Here is an answer from Unix stackexchange site on the same topic, though I didn’t find the language enough clear (completely my fault).

On uname -m , it says i686,what does this mean? and my system monitor window says «Release 11.10(oneiric) Kernel Linux 3.0.0-26-generic GNOME 3.2.1» It doesn’t specifies any thing,like one shown in your pic.

@Ubunu_beginner, i386 and i686 are both part of the x86 family of processors. They just refer to the specific age of the processor platform. i386 is an older platform (early 90s?) used back when 386 processors were used in machines. Then this was upgraded to 486 processors, which was the same basic instruction set as 386 just faster and newer. 586 was another upgraded and was when the term Pentium started floating around. Eventually all of these got encapsulated into the x86 architecture name. i686 just refers to the 6th generation of x86 architecture.

@frank Thank you. Actually it was the gnome-system-monitor before gnome migrated to version 3. And I forgot the theme name. But You can use same system monitor by installing mate-system-monitor application

Use Anwar’s answer to find the architecture.

Now here is the explanation for your second part of the question.

Below is the uname output: In my case I have installed a 32 bit version. Both i386 and i686 refer 32 bit version. uname will return x86_64 in case if it is a 64 bit version.

$ uname -a Linux devav2 3.2.0-30-generic-pae #48-Ubuntu SMP Fri Aug 24 17:14:09 UTC 2012 i686 i686 i386 GNU/Linux 
  • Linux(-s) — OS/Kernel name
  • devav2(-n) — hostname
  • 3.2.0-30-generic-pae (-r) — kernel release
  • 48-Ubuntu SMP Fri Aug 24 17:14:09 UTC 2012 (-v) — Kernel version with time and SMP stands for symmetric multiprocessing, which means you have multiprocessor support
  • i686(-m) — Machine hardware name
  • i686(-p) — processor type
  • i386(-i) — hardware platform
  • GNU/LINUX(-o) — Operating System name

Below is grabbed from uname —help page which might help you to understand more about it.

 -a, --all print all information, in the following order, except omit -p and -i if unknown: -s, --kernel-name print the kernel name -n, --nodename print the network node hostname -r, --kernel-release print the kernel release -v, --kernel-version print the kernel version -m, --machine print the machine hardware name -p, --processor print the processor type or "unknown" -i, --hardware-platform print the hardware platform or "unknown" -o, --operating-system print the operating system 

Источник

Оцените статью
Adblock
detector