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

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

1、查看内核版本


cat /proc/version
uname -a
uname -r

root@localhost:~$ cat /proc/version
Linux version 5.0.0-32-generic (buildd@lgw01-amd64-015) (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
root@localhost:~$ uname -r
5.0.0-32-generic
root@localhost:~$ 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

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

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


getconf LONG_BIT
file /bin/ls

root@localhost:~$ getconf LONG_BIT
64
root@localhost:~$ 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
root@localhost:~$ 

 

4、直接查看系统的架构


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

root@localhost:~$ dpkg --print-architecture 
amd64
root@localhost:~$ 
root@localhost:~$ arch
x86_64
root@localhostt:~$ 
root@localhostt:~$ 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
root@localhost:~$ 

admin

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

文章评论

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