Methods for Determining the System Architecture

This topic was published by and viewed 1922 times since "". The last page revision was "".

Viewing 1 post (of 1 total)
  • Author

  • DevynCJohnson
    • Topics - 437
    • @devyncjohnson

    In Linux, it may be important at times to know the architecture of the system. In a terminal, there are many ways to figure this out. Some of these methods may only work on particular Linux distros while some work on all (or nearly all) Linux systems.

    Most Linux system have the "uname" command. Type uname -pm to view the architecture.

    On Linux systems that use "init", type file /sbin/init. The output may look something like below.

    /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

    Another method includes using the "getconf LONG_BIT" command.

    Some systems support the "arch" command which is equivalent to running "uname -m".

    On Debian-based systems, users can use the dpkg --print-architecture command.

    On systems that use BASH, the code below will test the architecture type via a buffer overflow.

    if ((1<<32)); then
        echo "64-bit"
        echo "32-bit"

    On many Unixoid systems using proc, executing cat /proc/cpuinfo displays various information about the CPU.

    If one or more of these methods fail, then try the other listed methods until a command executes successfully and provides the needed information.

    Further Reading

Viewing 1 post (of 1 total)