Linux how to know my architecture

How to determine Linux kernel architecture?

uname -m gives i686 and uname -m gives i686 i386 output in Red Hat Enterprise Linux Server release 5.4 (Tikanga) machine. I need to install Oracle Database 10g Release 2 on that machine. So, how can I decide whether kernel architecture is 32bit or 64bit?

See also Linux command to return number of bits (32 or 64)?. If uname -m shows i?86, you have a 32-bit system.

14 Answers 14

i386 and i686 are both 32-bit.
x86_64 is 64-bit

behrooz@behrooz:~$ uname -a Linux behrooz 2.6.32-5-amd64 #1 SMP Mon Mar 7 21:35:22 UTC 2011 **x86_64** GNU/Linux 

@user7543 It’s ARM 32-bit, because we don’t have 64-bit ARM yet.When we do, It’s gonna be something different.

It’s simple! Use the arch command from coreutils package.

For Debian:

~ > dpkg --print-architecture amd64
~ > dpkg --print-foreign-architectures i386
~ > dpkg --print-architecture armhf

Thank you. I’ve been looking for something that would drop the ‘standard’ «amd64″/»i386» architecture names rather than just «x86_64». No one uses that terminology when naming precompiled releases.

Does CentOS/RedHat have an equivalent command? Or is this a problem on RH-based OSes? Trying to add support to an ansible role for the RH family to expand OS options for future servers.

@behrooz is correct. Unfortunately uname requires you to know architectures. Actually, I was looking for a list of architectures and I found this article that answers your question. In regards to uname -m :

x86_64 GNU/Linux indicates that you’ve a 64bit Linux kernel running. If you use see i386/i486/i586/i686 it is a 32 bit kernel.

To determine if the hardware is capable of running a 64-bit kernel

Look for the following in the output (all flags retrieved from this stackoverflow answer for the same question )

  • lm flag means Long mode cpu — 64 bit CPU
  • tm flag means Protected mode — 32-bit CPU
  • rm flag means Real Mode — 16 bit CPU

Does the lm flag simply mean the CPU supports 64-bit or does it mean that it’s running in 64-bit. I recommend relying on the arch knowing that it will be x86_64 for 64-bit or i?86 for 32-bit.

@penguin359, no but it’s often useful to find out if your OS is running 64-bit and if not if the hardware is capable, imo

The simplest way is to run:

which will output 64 or 32 depending on whether it is 32 or 64 bits.

dannyw@dannyw-redhat:~$ getconf LONG_BIT 64 

This answer is misleading. If you enable multiarch support and install 64 bit kernel over 32 bit installation getconf LONG_BIT will print 32 though you are running 64 bit kernel.

lscpu Architektura: x86_64 Tryb(y) pracy CPU: 32-bit, 64-bit Kolejność bajtów: Little Endian Address sizes: 39 bits physical, 48 bits virtual CPU: 8 Lista aktywnych CPU: 0-7 Wątków na rdzeń: 2 Rdzeni na gniazdo: 4 Gniazd: 1 Węzłów NUMA: 1 ID producenta: GenuineIntel Rodzina CPU: 6 Model: 60 Nazwa modelu: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz Wersja: 3 CPU MHz: 3392.293 CPU max MHz: 3900,0000 CPU min MHz: 800,0000 BogoMIPS: 6784.24 Wirtualizacja: VT-x Cache L1d: 128 KiB Cache L1i: 128 KiB Cache L2: 1 MiB Cache L3: 8 MiB Procesory węzła NUMA 0: 0-7 

use syscap from Formake project

Читайте также:  Английский язык linux mint

syscap allows to probe many system properties and test dependencies. It is a portable shell script.

Get kernel name and version:

syscap info -kernel -kernver 

Another way is to check the architecture some system file was compiled for, like

$ file /usr/bin/ld /usr/bin/ld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped 

That’s the system architecture, which isn’t always the kernel architecture. See this answer at SU for more variations.

Theoretically, they may differ, but is there a chance they would mismatch on any real-life installation?

Some distributions ship an amd64 kernel on the x86 version. I don’t know how many people use them, I checked Debian popcon but it doesn’t correlate between the various stats. I think the main use case is having a 32-bit main OS and running a 64-bit OS in a chroot or in a VM.

@Gilles You’re gonna love what you’ll read about the new x32 architecture, If I’m not too late, off course. wiki.debian.org/X32Port

Or you can use the way of what the uname command internally does if you want to implement some stuff on your own:

If you’re looking for a simple one-liner, this is the most reliable solution that I’ve found that returns 64 or 32. It doesn’t care if you’re running ARM or not, and it should work on any system using bash or sh.

Beware, this will assume the system is either 32-bit or 64-bit. See my explanation below if you need to detect 8- 16- or some-other-bit architecture.

[ $((0xffffffff)) -eq -1 ] && echo 32 || echo 64

What’s happing here?
The logic is very simple and it all boils down to how computers store signed integers. A 32-bit architecture only has 32 bits that it can use for storing signed integers while a 64-bit architecture has 64 bits! In other words the set of integers that can be stored is finite. Half of this set represents negative numbers and half represents positive numbers. The signed integer equalling -1 is represented as the largest number that can be stored in a given number of bits for that architecture. On a 32-bit system, -1 can be represented by the hex value 0xFFFFFFFF (which is 32 binary bits, all equalling 1). On a 64-bit system, 0xFFFFFFFF translates to 4,294,967,295, base 10 while 0xFFFFFFFFFFFFFFFF is the representation for -1). You can see how this would easily scale for systems that are 8- or 16-bit as well which would equal -1 at 0xFF and 0xFFFF, respectively.

Источник

How to Find Out CPU Architecture (32 bit or 64 bit) in Linux

Some times it is very important to know whether the Server’s CPU Architecture is of 32-bit or 64-bit because 64-bit applications can not run on 32-bit system, whereas 32-bit application can easily be run on 64-bit system.

One can determine Linux System CPU architecture using the file /proc/cpuinfo , example is shown below :

[[email protected] ~]# cat /proc/cpuinfo | grep -i flags flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc up rep_good pni monitor ssse3 lahf_lm

In the above output, we could either see lm , tm or rm , these flags indicates about CPU architecture.

Читайте также:  Добавление скрипта автозагрузку linux

So as per above output, Server’s CPU is of 64 bit.

Apart from /proc/cpuinfo, we can also check the CPU architecture using lscpu command, in the output look for CPU op-modes(s). We can also use lshw command to view CPU architecture, execute following command and in the output look for width parameter,

Find CPU architecture using dmidecode command

Run the beneath dmidecode command and in the output look for “Characteristics:” parameter which will show whether CPU architecture is 64-bit or 32-bit

Determine whether a given Linux is 32 bit or 64 bit?

We can find the whether installed Linux system on which we are working is 32-bit or 64-bit using commands like lscpu, ‘uname -m‘ and getconf

Output will be something like below and look for Architecture, as per output below 64-bit Linux is installed on the system,

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 37
Stepping: 5
CPU MHz: 933.000
BogoMIPS: 4787.82
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
NUMA node0 CPU(s): 0-3

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

Above Command will display whether Kernel Version is 32 bit or 64 bit

with help of getconf command we can also find whether the installed Linux is of 32-bit or 64-bit

Источник

How to find the processor / chip architecture on Linux

uname -m gives you back i686 or x86_64 depending on 32-bit or 64-bit Intel CPU, but I don’t have access to machines on non-Intel architectures.

x86_64 or amd64 would be 64-bit. i386, i486, i586, and i686 are 32-bit. Keep in mind however that those values are merely a reflection of the target the kernel was compiled for and not necessarily what the CPU is capable of.

6 Answers 6

To display kernel architecture: uname -p

To display extended CPU details: cat /proc/cpuinfo

uname (with any options) will only show the kernel architecture, not the physical CPU architecture. In other words, it will show which CPU the kernel was compiled for. But that could show i386 even when running on a x86_64 CPU.

which returns output like this:

Architecture: i686 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 2 On-line CPU(s) list: 0,1 Thread(s) per core: 1 Core(s) per socket: 2 Socket(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 23 Stepping: 6 CPU MHz: 2670.000 BogoMIPS: 5320.13 L1d cache: 32K L1i cache: 32K L2 cache: 3072K 

To only get the architecture:

I’m surprised no one suggested uname -m . On my laptop, this gives armv7l , while uname -a gives me a monstrous two lines of text.

A concise command producing information about the current machine is hostnamectl . Example output:

Static hostname: xxxx Icon name: computer-laptop Chassis: laptop Boot ID: b3a1f952c514411c8c4xxxxxxxxxxxx Operating System: Ubuntu 14.04.3 LTS Kernel: Linux 3.19.0-43-generic Architecture: x86_64 

It gives you the most basic information about your machine. Other commands like uname , lsb_release , or lscpu return more specific information.

Источник

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)?

Читайте также:  Email servers in linux

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

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