- How to check for 32-bit / 64-bit kernel for Linux
- 7 Answers 7
- How to find if Linux is running on 32-bit or 64-bit
- How Linux Operates?
- Linux and Open-Source:
- Why Linux?
- How to determine if a Computer is running a 32-bit or 62-bit OS?
- 32-bit or 64-bit Operating System Information:
- Using Various Commands:
- Check with the «uname» Command:
- Check with the Command “uname-m”:
- Check with the Command “arch” and “dpkg” and other commands:
- Check with the command “file” with Special arguments:
- Check with the Iscpu Command:
- Using Graphical Interface:
How to check for 32-bit / 64-bit kernel for Linux
I need to write a bash script where i have to check whether the Linux kernel is 32 bit or 64 bit. I am using uname -a command, and it gives me x86_64 result. But I believe I can not use it in the generic way because result may differ if some one using non x86 architecture. How to check for 32-bit / 64-bit kernel for Linux?
When you say «installation», do you mean the kernel? Because you can use a 64-bit kernel with a 32-bit installation.
7 Answers 7
The question is rather: what do you intend to achieve by knowing whether you are on 32 or 64? What are the consequences of being on a hypothetical 128-bit environment? And what part actually is being tested for N-bitness? A CPU may support running in 64-bit mode, but the environment be 32-bit. Furthermore, the environment itself may be a mixed-mode; consider running a 64-bit kernel with a 32-bit userspace (done on a handful of classic RISCs). And then, what if the userspace is not of a homogenous bitness/executable format? That is why getconf LONG_BIT is equally pointless to use, because it depends on how it was compiled.
$ /rt64/usr/bin/getconf LONG_BIT 64 $ /usr/bin/getconf LONG_BIT 32 $ file /usr/bin/getconf /rt64/usr/bin/getconf /usr/bin/getconf: ELF 32-bit MSB executable, SPARC32PLUS, V8+ Required, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.4, not stripped /rt64/usr/bin/getconf: ELF 64-bit MSB executable, SPARC V9, relaxed memory ordering, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.4, not stripped $ uname -m sparc64
How to find if Linux is running on 32-bit or 64-bit
An operating system or OS is software that directly controls the resources and system hardware like storage, CPU, and hardware. Linux System is an OS. An Operating System parks between the hardware and applications to make bonding between all physical resources and software that performs.
-
- How Linux Operates?
- Linux and Open-Source:
- Why Linux?
- How to determine if a Computer is running a 32-bit or 62-bit OS?
- 32-bit or 64-bit Operating System Information:
- Using Various Commands:
- Check with the «uname» Command:
- Check with the Command “uname-m”:
- Check with the Command “arch” and “dpkg” and other commands:
- Check with the command “file” with Special arguments:
- Check with the Iscpu Command:
How Linux Operates?
Linux Operating System was developed to be the same OS as UNIX.
It has been developed to operate various hardware, from computers to smartphones.
Each Linux-based OS concerns the Linux Kernel, which is responsible for managing resources related to hardware.
A batch of packages related to software that creates the rest of the OS.
Companies can run their Linux Operating Systems on a Linux Server.
These tools provide a way to manage the resources by installing additional software.
All of these instruments are bounded concurrently for making up the OSfunctions.
Linux is an open-source OS, and various software can change between distributions.
Linux and Open-Source:
The world’s largest open-source project is Linux.
Hobbyists, professional developers, and programmers worldwide have contributed to the design features of the Linux kernel, fixing and finding bugs and security issues, providing different ideas, and live patching.
These all are contributed while sharing their grants back to society.
Why Linux?
If a user struggles with the abovementioned problems, Linux OS is perfect.
Linux is developed in one of the most steadfast computer ecosystems globally.
Connect that reliability with zero expense of entry, and you will come up with the perfect solution for a platform related to desktops.
That’s very true; zero cost for entry means free. You can install Linux on as many computers as you want without paying even a single penny for server licensing or software.
How to determine if a Computer is running a 32-bit or 62-bit OS?
In this quick post, you will easily find out the details of your Linux system. Suppose you consider installing a new application on the Linux OS or Ubuntu system to avoid conflicts. In that case, inspecting whether it is compatible with a 32-bit or 64-bit OS is better.
Now let’s see how to check whether your operating system is 32-bit or 64-bit. We will consider both ways from the shell and the GUI.
Before proceeding with the following command, let’s dive into the basic information of 32-bit operating systems or 64-bit operating systems.
32-bit or 64-bit Operating System Information:
Many modern systems and computers are based on and capable of running a 64-bit OS. But it does not mean that what is running just on the base of support by computer.
Here is the way to signify whether your computer is running a 32-bit or 64-bit version of the operating system of Linux in the system information command.
In the early years of the ’90s, the processors were based on 32-bit versions of OS. It signifies that their data bus can handle 32-bit at one time. With time and as technology grew, a 64-bit processor substituted 32-bit.
64-bit processors consist of a data bus with 64 bits. It signifies that this processor type can handle system operations at a faster rate than compared to a 32-bit processor. OS has released 64 bits versions to meet the specifications of 64-bit processors.
According to our recommendation, a 64-bit version of Linux is advised for most parts. Users will get a better experience in performance and security.
The only term you may need to install a 32-bit Linux version is when you run a 32-bit processor or in a rare situation when you have hardware drivers with the properties of a 32-bit processor type, but it is usually a fault in Windows.
By opening the system properties, you can check system settings to find out if the Linux OS is running on 32-bit or 64-bit in the system information. Various Linux Commands can be used to identify the Linux version.
These Linux commands will show the operating system’s name, hardware type, and system version.
Here are the ways to determine between a 32-bit or 64-bit version if you will install any software, and you are asked to choose which version of Linux you are using.
You can identify the version of your system in two main ways. These are:
- By using various commands like “arch, uname, file and Iscpu”
- By using the graphical interface
Using Various Commands:
Check with the «uname» Command:
The first method to check whether your Linux system is 32-bit or 64-bit is to find through the “uname” command, which will print the system information on the screen.
Moreover, the following command getconf command is used by typing “getconf LONG_BIT” to see if the current bit-width of your system is 32-bit or 64-bit.
The getconf command shows the values of system limits and system configuration variables. This command is quite helpful for checking the configuration limits.
Follow the steps below to get further information:
- Open the terminal
- Type the following command “uname” and press “Enter”
- You will see the information of your system as an output on your screen
Now, let’s comprehend the structure for a better understanding.
- Kernel name
- Kernel version
- Kernel release
- Network node hostname
- Machine hardware name
- Operating system
- Processor type
- Hardware platform
The machine hardware name detects whether your system is 32-bit or 64-bit. A new-found 64-bit Linux Install will show the output as “x86_64” if running a 64-bit version.
However, it will display the 32-bit processor type in the following ways:
In the case of a 64-bit version, it will show the output in the following way:
Check with the Command “uname-m”:
Another way to know the version of your system is to type the command “uname -m”.
A user can use system configuration variables to find if the Linux mint runs on 32-bit or 64-bit. These system configuration variables can be executed using the command “uname -m” in the terminal.
To perform under this command, you will need to follow the steps below:
- Open the terminal
- Type the command “uname -m” and press “Enter”
- The system will display the specifications of your system as output which are
- Described under the above heading.
Check with the Command “arch” and “dpkg” and other commands:
The dpkg command explores whether Linux is based on 32-bit or 64-bit.
All you have to do is to run the dpkg command by typing “dpkg –print architecture” in the terminal, and it will show the OS type of architecture running.
Another command identical to “uname -m” is the “arch” command. It shows whether your system is i686 (32-bit) or x86_64 (64-bit).
Arch command will print the architecture and print the data like “arm, i586, alpha, i486, i386, m68k, sparc, mips, x86_64, etc”
You will need to perform the steps mentioned below:
- Open the terminal
- Type the command “arch” and press “Enter”
- Check the output as shown in the image below
Check with the command “file” with Special arguments:
Using the file type command, you can check with a special argument (“/sbin/init”) to see whether your system is the 32-bit or 62-bit version of the OS and can also check the libraries that are dynamically linked.
By using this command with the special argument “-L” the user can check the system version.
For instance, if the prints system information output of this command is “ELF 64-bit LSB executable, it means the processor is 64-bit.
If the output is “ELF 32-bit LSB executable”,the system is based on a 32-bit OS.
- Type the following commands “file /sbin/init” and press the button “Enter”
- the computer will show the output in the following format
Check the version of the Linux.
Check with the Iscpu Command:
To check the output whether your Linux system has a 32-bit or 64-bit and to notice the version of the installed OS Linux, perform the following steps under lscpu command:
The entry “Architecture” shows the os type of CPU you are using.
If the output is “x86_64” it indicates that 64-bit is running.
“x86_32” identifies that the processor is running a 32-bit version of Linux.
The “CPU op-mode(s)” indicates the version of Linux.
If your computer runs a 64-bit version, you will notice both 64-bit and 32-bit modes, as a 64-bit processor can run both.
If you see it listed as only 32-bit mode, it shows your system type has a 32-bit version of Linux.
This exact command displays the complete architecture of the CPU where the user can see if the CPU is 32-bit or 64-bit.
Using Graphical Interface:
Now let’s bounce into the graphical tool to test the version of Linux.
You will be required to click on the “System” menu or the gear button at the upper-right corner of your system screen and hit click on the option “System Settings” from the dropdown menu.
See the “Details” button in the section “system” as demonstrated below:
The “Operating System Type or OS type” is listed in the “Overview” screen as either 32-bit or 64-bit, paired with other information about your Ubuntu system type.
You must remember that a 64-bit process can support 32-bit and 64-bit OS.
32-bit processors don’t support the 64-bit OS and will only support the 32-bit OS.
Bilal Mohammed is a cyber security enthusiast passionate about making the internet safer. He has expertise in penetration testing, networking, network security, web development, technical writing, and providing security operations center services. He is dedicated to providing excellent service and quality work on time. In his spare time, he participates in Hack the box and Vulnerable By Design activities.