Homepage › Forums › Articles › Operating Systems › Linux › Shell/Command-line › Methods for Determining the System Architecture
This topic was published by DevynCJohnson and viewed 1978 times since "". The last page revision was "".
- AuthorPosts
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" else echo "32-bit" fi
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
- x86 vs i386 vs Other Processor Terms - https://dcjtech.info/topic/x86-vs-i386-vs-other-processor-terms/
- Hardware Probing Using Linux - https://dcjtech.info/topic/hardware-probing-using-linux/
- AuthorPosts