Try
uname -m
. It seems like the uname -m
actually givesx86_64 ==> 64-bit kernel
i686 ==> 32-bit kernel
lscpu
will list out these among other information regarding your CPU:Architecture: x86_64
CPU
op-mode(s): 32-bit, 64-bit
Another useful command for easy determination is as below:
Command:
Command:
getconf LONG_BIT
Answer:- 32, if OS is 32 bit
- 64, if OS is 64 bit
In Bash, using integer overflow:
if ((1<<32)); then
echo 64bits
else
echo 32bits
fi
It's much more efficient than invoking another process or opening files.
No comments:
Post a Comment