Linux判断系统架构的方法和示例(ARM或AMD或Intel的x86或x64)

2022-07-24 230点热度 0人点赞 0条评论

1、查看内核版本


cat /proc/version
uname -a
uname -r

[email protected]:~$ cat /proc/version
Linux version 5.0.0-32-generic ([email protected]) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #34~18.04.2-Ubuntu SMP Thu Oct 10 10:36:02 UTC 2019
[email protected]:~$ uname -r
5.0.0-32-generic
[email protected]:~$ uname -a
Linux zhihui-mint 5.0.0-32-generic #34~18.04.2-Ubuntu SMP Thu Oct 10 10:36:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

2、查看linux版本信息


lsb_release -a
cat /etc/issue

[email protected]:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	LinuxMint
Description:	Linux Mint 19.3 Tricia
Release:	19.3
Codename:	tricia
[email protected]:~$ cat /etc/issue
Linux Mint 19.3 Tricia \n \l

3、查看linux是64为还是32位


getconf LONG_BIT
file /bin/ls

[email protected]:~$ getconf LONG_BIT
64
[email protected]:~$ file /bin/ls
/bin/ls: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=9567f9a28e66f4d7ec4baf31cfbf68d0410f0ae6, stripped
[email protected]:~$ 

 

4、直接查看系统的架构


dpkg --print-architecture
arch
file /lib/systemd/systemd

[email protected]:~$ dpkg --print-architecture 
amd64
[email protected]:~$ 
[email protected]:~$ arch
x86_64
[email protected]:~$ 
[email protected]:~$ file /lib/systemd/systemd
/lib/systemd/systemd: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=85c772a89c42ba78383dec576b414b2b953cbe41, stripped
[email protected]:~$ 

admin

这个人很懒,什么都没留下

文章评论

您需要 登录 之后才可以评论