43

What command should I use to find the processor / chip architecture on Linux?

linux-x86-32
linux-x86-64
linux-ppc-64
Matthias Braun
  • 32,039
  • 22
  • 142
  • 171
Jason
  • 12,229
  • 20
  • 51
  • 66
  • 4
    `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. – wkl Aug 15 '11 at 15:13
  • uname -m says i686. How do I know if its 32 or 64 bit? – Jason Aug 15 '11 at 15:23
  • 4
    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. – James O'Doherty Aug 15 '11 at 16:31
  • 1
    To know the current architecture of your OS type: `getconf -a | grep LONG_BIT` – Watchmaker Jul 08 '15 at 20:06

6 Answers6

63

To display kernel architecture: uname -p

To display extended CPU details: cat /proc/cpuinfo

Slava Fomin II
  • 26,865
  • 29
  • 124
  • 202
joet3ch
  • 2,236
  • 1
  • 21
  • 19
  • 13
    More specifically, `uname -p` for processor architecture. – Steve Wang Aug 15 '11 at 15:12
  • 5
    `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. – Dan Moulding Jun 23 '17 at 18:03
  • 5
    `uname -p` gives me `unknown` – Elie G. Nov 04 '21 at 23:47
30

In the terminal, type

lscpu

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:

lscpu | grep Architecture

Which in this case is

Architecture:          i686

See man lscpu for more.

Matthias Braun
  • 32,039
  • 22
  • 142
  • 171
Montells
  • 6,389
  • 4
  • 48
  • 53
24

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.

Matthias Braun
  • 32,039
  • 22
  • 142
  • 171
James Ko
  • 32,215
  • 30
  • 128
  • 239
  • Possible values listed at: https://stackoverflow.com/questions/45125516/possible-values-for-uname-m – Ciro Santilli OurBigBook.com Aug 13 '20 at 16:10
  • lscpu works if installed, but that does not seem available on MacOS or many container images. I have found that "uname -m" seems far more widely available by default, so I would consider that to be the preferred solution. – Udo Schuermann Aug 10 '23 at 16:50
10

see (man uname):

echo `uname -s`-`uname -p`
Delimitry
  • 2,987
  • 4
  • 30
  • 39
Jack
  • 101
  • 1
  • 2
7

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.

Matthias Braun
  • 32,039
  • 22
  • 142
  • 171
infoclogged
  • 3,641
  • 5
  • 32
  • 53
0

You could use lscpu with grep to get only architecture.

lscpu | grep Architecture | awk {'print $2'}

Example output:

x86_64
Ewilan R.
  • 429
  • 8
  • 10