- How to determine whether a given Linux is 32 bit or 64 bit?
- 21 Answers 21
- difference between i386:x64-32 vs i386 vs i386:x86_64
- 2 Answers 2
- What is the difference between x86_64 and i386?
- 2 Answers 2
- You must log in to answer this question.
- Linked
- Related
- Hot Network Questions
- Subscribe to RSS
- Как узнать разрядность Linux
- Как посмотреть разрядность Linux
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).
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).
difference between i386:x64-32 vs i386 vs i386:x86_64
Can someone explain the difference between the three architectures? Actually when I built a 64-bit application in Linux, I got a link error saying:
skipping incompatible library.a when searching for library.a
a.o: file format elf32-x86-64 architecture: i386:x64-32, flags 0x00000011: HAS_RELOC, HAS_SYMS start address 0x00000000
Note that static libraries are generally far more trouble than they are worth. Use dynamic libraries, with an $ -relative -rpath if you really need to and don’t need setuid or any other capabilities .
2 Answers 2
There are 3 common ABIs usable on standard Intel-compatible machines (not Itanium).
- The classic 32-bit architecture, often called «x86» for short, which has triples like i486-linux-gnu . Registers and pointers are both 32 bits.
- The 64-bit extension originally from AMD, often called «amd64» for short, which has GNU triple of x86_64-linux-gnu . Registers and pointers are both 64 bits.
- The new «x32» ABI, with a triple of x86_64-linux-gnux32 . Registers are 64 bits, but pointers are only 32 bits, saving a lot of memory in pointer-heavy workflows. It also ensures all the other 64-bit only processor features are available.
Each of the above has its on system call interface, own ld.so , own complete set of libraries, etc. But it is possible to run all 3 on the same kernel.
On Linux, their loaders are:
% objdump -f /lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 /libx32/ld-linux-x32.so.2 /lib/ld-linux.so.2: file format elf32-i386 architecture: i386, flags 0x00000150: HAS_SYMS, DYNAMIC, D_PAGED start address 0x00000a90 /lib64/ld-linux-x86-64.so.2: file format elf64-x86-64 architecture: i386:x86-64, flags 0x00000150: HAS_SYMS, DYNAMIC, D_PAGED start address 0x0000000000000c90 /libx32/ld-linux-x32.so.2: file format elf32-x86-64 architecture: i386:x64-32, flags 0x00000150: HAS_SYMS, DYNAMIC, D_PAGED start address 0x00000960
Now, if you’re getting the message about «skipping incompatible library», that means something is messed up with your configuration. Make sure you don’t have bad variables in the environment or passed on the command line, or files installed outside of your package manager’s control.
What is the difference between x86_64 and i386?
What is the difference? Under what category does my system fall into? I want to download Fedora12 and it shows me these options. Which one should I download? I have a Sony Vaio cr36g/b with an Intel Core 2 Duo 8100 processor.
2 Answers 2
x86_64 is for 64 bit processors. i386 is for 32 bit processors.
All Core 2 Duos are capable of running 64 bit operating systems and 32 bit operating systems.
You want x86_64 as it will run better and allow you to have more RAM in the future, although if you are worried about compatibility, you could use i386 . Personally I haven’t had any problems with x86_64 on Linux.
Was it really necessary to ask «mine is core 2 duo 8100. Is it capable of running 64 bit OS?» in every single answer? I mean come on.
Necessary, no. But it does alert the person that their comment was replied to so they can follow up on the new comment.
x86_64 refers to 64-bit processors. i386 refers to 32-bit processors.
If you really do have an Intel Core 2 Duo, then it is a 64-bit processor. Some of the Intel Core processors were 32-bit. You can download either or — it depends if you want to run the 64-bit version. It gives you advantages of being able to use more memory (> 4GB per process, > 4GB in total without leveraging PAE) and in some instances will operate more quickly (and others more slowly).
You must log in to answer this question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.14.43533
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Как узнать разрядность Linux
Разрядность операционной системы определяет набор инструкций процессора, которые будут использоваться для работы с данными и памятью компьютера. Существует две самые популярные разрядности, это i386 или 32 битная разрядность и x86_64 или 64 битная разрядность. Первая уже устаревшая и поддерживает работу с не больше чем 4 гигабайта оперативной памяти.
Вторая же более современная и сейчас используется практически везде. Все современные процессоры поддерживают обе архитектуры, однако многие дистрибутивы Linux уже отказались от поддержки i386 в пользу x86_64. В этой небольшой статье мы рассмотрим как узнать разрядность Linux.
Как посмотреть разрядность Linux
Самый простой способ узнать разрядность операционной системы Linux — это воспользоваться утилитой arch. Она просто выводит разрядность и больше ничего:
Команда uname выводит архитектуру ядра Linux если передать ей опцию -m, архитектура ядра соответствует архитектуре системы, поэтому этот метод можно использовать:
Команда file позволяет просматривать информацию о файлах в файловой системе. Для исполняемых файлов отображается их архитектура. Если вы посмотрите архитектуру какого-либо важного системного файла, то узнаете и разрядность системы. Например:
Вы можете узнать разрядность системы и в графическом интерфейсе. Например, в Ubuntu, для этого надо открыть утилиту Настройки, а затем раздел О системе:
Тут есть пункт Тип ОС, в котором указана разрядность системы. В данном случае, это 64 бит. Обратите внимание, что то, что система имеет архитектуру 64 бит не означает, что она не может запускать 32 битные программы и библиотеки. Эта архитектура сохраняет обратную совместимость и процессоры всё ещё могут выполнять 32 битные программы. Для этого достаточно установить пакет совместимости и необходимые 32 битные библиотеки. Но в обратную сторону это не работает, 32 битные системы не могут выполнять 64 битные программы. Во всяком случае теперь вы знаете как посмотреть разрядность системы Linux.
Обнаружили ошибку в тексте? Сообщите мне об этом. Выделите текст с ошибкой и нажмите Ctrl+Enter.