有時候我們需要知道現在執行的環境是 32 位系統還是 64 位系統還有具體使用什麼版本,可以用 linux 的命令來檢視下,都有哪些比較簡單的辦法那,這裡做個小小的總結。
x86_64即為64位的,如果出現i386或i686等為32位系統。[root@localhost testcode]# cat /proc/version
linux version 3.10.0-693.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (red hat 4.8.5-16) (gcc) ) #1 smp tue aug 22 21:09:27 utc 2017
cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l
根據cpu的flag判斷是不是有lm標識,有代表是64位linux系統。
顯示ls為 64-bit可執行程式,顯然應該是64位系統。[root@localhost testcode]# file /bin/ls
/bin/ls: elf 64-bit lsb executable, x86-64, version 1 (sysv), dynamically linked (uses shared libs), for gnu/linux 2.6.32, buildid[sha1]=3d705971a4c4544545cb78fd890d27bf792af6d4, stripped
這個方法,我用的最多,命令如下:
此命令可以獲得系統的基本資訊,比如記憶體大小,磁碟大小,以及系統位數等。[root@localhost ~]# uname -m
x86_64
這個方法很直觀,卻很少用,主要了解不夠多。[root@localhost ~]# getconf long_bit
64
[root@localhost ~]# arch
x86_64
這樣命令看也可以看出來是linux系統,64位,以及核心版本等,el企業版linux。比較亂不如:[root@localhost ~]# uname -a
linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 smp tue aug 22 21:09:27 utc 2017 x86_64 x86_64 x86_64 gnu/linux
說明:[root@localhost ~]# uname -m
x86_64
[root@localhost ~]# uname -r
3.10.0-693.el7.x86_64
[root@localhost ~]# uname -s
linux
[root@localhost ~]# uname -v
#1 smp tue aug 22 21:09:27 utc 2017
[root@localhost ~]# uname -i
x86_64
[root@localhost ~]# uname -p
x86_64
-a, --all print all information, in the following order,except omit -p and -i if unknown:
-s, --kernel-name print the kernel name
-n, --nodename print the network node hostname
-r, --kernel-release print the kernel release
-v, --kernel-version print the kernel version
-m, --machine print the machine hardware name
-p, --processor print the processor type or "unknown"
-i, --hardware-platform print the hardware platform or "unknown"
-o, --operating-system print the operating system
--help display this help and exit
--version output version information and exit
如果沒有可以安裝下:[root@localhost testcode]# lsb_release -a
lsb version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
distributor id: centos
description: centos linux release 7.4.1708 (core)
release: 7.4.1708
codename: core
只適合於redhat類的[root@localhost testcode]# yum install -y redhat-lsb
loaded plugins: fastestmirror, langpacks
這兩個命令不錯,可以看到具體的系統版本詳細資訊。[root@localhost testcode]# cat /etc/redhat-release
centos linux release 7.4.1708 (core)
[root@localhost testcode]# cat /proc/version
linux version 3.10.0-693.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (red hat 4.8.5-16) (gcc) ) #1 smp tue aug 22 21:09:27 utc 2017
hadoop版本和位數的檢視方法
目前針對apache hadoop更新的版本較多,由此而產生了兩個方面的問題 1 如何檢視執行的集群當中的hadoop的版本的問題。2 如何檢視執行集群當中的hadoop的位數 下面詳細的介紹一下 1 檢視版本資訊 通過在集群上執行 hadoopversion 命令可以檢視對應的hadoop的版本。...
linux系統位數檢視和cpu位數
1.uname a如果有x86 64就是64位的,沒有就是32位的 這是64位的 uname a linux desktop 2.6.35 23 generic 37 ubuntu smp fri nov 5 19 17 11 utc 2010 i686 gnu linux 這是32位的 uname...
linux檢視核心版本和產品版本
linux檢視核心版本和廠商版本 1.檢視核心版本命令 1 root q1test01 cat proc version linux version 2.6.9 5.elsmp bhcompile decompose.build.redhat.com gcc version 3.4.3 200412...