115

When running uname -a, I get as output

41-Ubuntu SMP Mon Aug 13 17:59:54 UTC 2012 i686 athlon i386 GNU/Linux

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

Peachy
  • 7,117
  • 10
  • 38
  • 46

6 Answers6

129

The command is uname -m.

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

Anwar
  • 76,649
  • 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.
    – python_beginner Sep 17 '12 at 06:39
  • i686 means 32bit – Anwar Sep 17 '12 at 06:40
  • 4
    @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. – Ankit Sep 17 '12 at 12:51
  • In Ubuntu 17.10 there is no system tab in system monitor – coding_ninza Jan 15 '18 at 11:41
  • @coding_ninza You can find it in Settings -> About section. Have you found it? – Anwar Jan 16 '18 at 14:30
  • yes I find it in setting after opening setting I click on details and then it shows OS type-64-bit. – coding_ninza Jan 16 '18 at 14:42
  • @Anwar Where'd you get your cool-looking System Monitor? I have Ubuntu 16.04 but nothing fancy like that – Nathan majicvr.com Apr 17 '18 at 02:52
  • 1
    @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 – Anwar Apr 18 '18 at 09:26
  • @Anwar I ask because mine literally doesn't have the "System" tab – Nathan majicvr.com Apr 19 '18 at 01:58
  • Yeah I know. They've changed it a lot. @frank – Anwar Apr 20 '18 at 05:55
25

For debian Linux derived systems, one possible command is dpkg-architecture -q DEB_BUILD_ARCH.

On 64bits systems, it returns :

$ dpkg-architecture -q DEB_BUILD_ARCH
amd64

On 32bits systems, it returns :

$ dpkg-architecture -q DEB_BUILD_ARCH
i386
SebMa
  • 2,291
25

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
devav2
  • 36,312
  • 1
    uname -m will return x86_64 in case if it is a 64 bit version - This is what I was looking for. Thanks. – RBT May 09 '18 at 23:48
3

I find @Callum Rogers 's comment to be the best answer:

dpkg --print-architecture

amd64

isapir
  • 513
2

If all you want is the architecture you could always try the command called arch. It is very terse. It is not POSIX.

DDay
  • 121
-2

use syscap from Formake project https://sourceforge.net/projects/formake syscap allows to probe many system properties and test dependencies. It is a portable shell script.

Alex
  • 1
  • 3
    Seems waaaaay overkill to get system architecture. According to your link "Formake is a toolkit for developing portable software build systems" (though I don't doubt it has a utility to check architecture) and is in alpha, so seems like nobody would want to install it for this simple purpose. If you're affiliated with the project, you should disclose that. – Zanna Apr 02 '17 at 21:57