1.服務器硬件信息查看
1.1.服務器廠商、產品名稱查看
dmidecode -s system-manufacturer:查看服務器廠商信息
dmidecode -s system-product-name:查看服務器產品名稱信息
1.Windows使用VMware安裝的Linux(Centos 7.6)后,服務器廠商、產品名稱信息查看。
[root@localhost ~]# dmidecode -s system-manufacturer
VMware, Inc.
[root@localhost ~]# dmidecode -s system-product-name
VMware Virtual Platform
2.其他常見的服務器信息,如:新華三的R4900服務器、華為的S920服務器。
1.新華三R4900服務器
[root@node1 ~]# dmidecode -s system-manufacturer
New H3C Technologies Co., Ltd.
[root@node1 ~]# dmidecode -s system-product-name
UniServer R4900 G32.華為S920服務器
[root@node2 ~]# dmidecode -s system-manufacturer
Huawei
[root@node2 ~]# dmidecode -s system-product-name
S920X00
1.2.服務器架構查看
uname -m:服務器架構查看
1.Windows使用VMware安裝的Linux(Centos 7.6)后,服務器架構信息查看,x86架構顯示x86_64,64指64位系統。
[root@localhost ~]# uname -m
x86_64
2.其他常見架構信息,如:arm架構顯示aarch64,目前常見架構就是x86和arm架構;64指64位系統,常見的有32位系統、64位系統,目前大部分都是64位。
[root@node2 ~]# uname -m
aarch64
1.3.CPU核數、NUMA查看
lscpu:查看CPU信息
1.Windows使用VMware安裝的Linux(Centos 7.6)后,CPU核數和NUMA信息查看。CPU(s)后值為4,代表核數是4核。NUMA node(1)后值為1,代表NUMA只有1個。NUMA node0 CPU(s)后值為0-3,代表NUMA名稱為node0,核數包括0-3共4核。
[root@localhost ~]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 2
NUMA node(s): 1
... ...
Model name: Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
... ...
NUMA node0 CPU(s): 0-3
... ...
2.其他常用服務器CPU核數和NUMA查看。x86服務器共56核,分兩個NUMA,NUMA node0核數是0-13及28-41,NUMA node1核數是14-27及42-55。arm服務器架構共128核,分四個NUMA,NUMA 節點0(node0)是0-31,NUMA 節點1(node1)是32-63,NUMA 節點2(node2)是64-95,NUMA 節點3(node3)是96-127。
1.x86的cpu信息
[root@node1 ~]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 56
On-line CPU(s) list: 0-55
Thread(s) per core: 2
Core(s) per socket: 14
Socket(s): 2
NUMA node(s): 2
... ...
Model name: Intel(R) Xeon(R) Gold 6132 CPU @ 2.60GHz
... ...
NUMA node0 CPU(s): 0-13,28-41
NUMA node1 CPU(s): 14-27,42-55
... ...2.arm的cpu信息
[root@node2 ~]# lscpu
架構: aarch64
CPU 運行模式: 64-bit
字節序: Little Endian
CPU: 128
在線 CPU 列表: 0-127
每個核的線程數: 1
每個座的核數: 64
座: 2
NUMA 節點: 4
... ...
型號名稱: Kunpeng-920
... ...
NUMA 節點0 CPU: 0-31
NUMA 節點1 CPU: 32-63
NUMA 節點2 CPU: 64-95
NUMA 節點3 CPU: 96-127
... ...
1.4.內存信息查看
free -h:內存信息查看
1.Windows使用VMware安裝的Linux(Centos 7.6)后,內存信息查看。主要包括Mem(內存)、Swap(可交換內存),兩種各種的總值、使用值、空閑值,Mem還包括一些共享、緩存值等。
[root@localhost ~]# free -htotal used free shared buff/cache available
Mem: 3.7G 736M 2.2G 23M 746M 2.6G
Swap: 3.9G 0B 3.9G
1.5.磁盤信息查看
df -h:顯示文件系統信息,主要查看系統磁盤掛載信息及系統目錄空間
fdisk -l:是Linux系統的磁盤分區工具,也查看磁盤信息及掛載類型
Windows使用VMware安裝的Linux(Centos 7.6)后,查看磁盤信息、掛載信息、目錄空間信息。
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 56G 3.9G 52G 7% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 13M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 297M 157M 140M 53% /boot
tmpfs 378M 8.0K 378M 1% /run/user/42
tmpfs 378M 28K 378M 1% /run/user/0
[root@localhost ~]# fdisk -lDisk /dev/sda: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000ab4ceDevice Boot Start End Blocks Id System
/dev/sda1 * 2048 616447 307200 83 Linux
/dev/sda2 616448 8744959 4064256 82 Linux swap / Solaris
/dev/sda3 8744960 125829119 58542080 83 Linux
1.6.網絡信息查看
ifconfig:查看、配置、啟用或禁用網絡接口的工具,功能強大,這里主要用于查看網絡信息
ip addr:ip是強大的網絡配置工具,ip addr顯示網卡IP信息
Windows使用VMware安裝的Linux(Centos 7.6)后,查看Linux服務器IP信息。
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500inet 192.168.118.201 netmask 255.255.255.0 broadcast 192.168.118.255inet6 fe80::1211:5c3b:18a0:2b72 prefixlen 64 scopeid 0x20<link>ether 00:0c:29:da:ad:2d txqueuelen 1000 (Ethernet)RX packets 3261 bytes 282978 (276.3 KiB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 2144 bytes 1410541 (1.3 MiB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536inet 127.0.0.1 netmask 255.0.0.0inet6 ::1 prefixlen 128 scopeid 0x10<host>loop txqueuelen 1000 (Local Loopback)RX packets 240 bytes 25704 (25.1 KiB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 240 bytes 25704 (25.1 KiB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255ether 52:54:00:c8:6a:42 txqueuelen 1000 (Ethernet)RX packets 0 bytes 0 (0.0 B)RX errors 0 dropped 0 overruns 0 frame 0TX packets 0 bytes 0 (0.0 B)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0[root@localhost ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:da:ad:2d brd ff:ff:ff:ff:ff:ffinet 192.168.118.201/24 brd 192.168.118.255 scope global noprefixroute ens33valid_lft forever preferred_lft foreverinet6 fe80::1211:5c3b:18a0:2b72/64 scope link noprefixroute valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000link/ether 52:54:00:c8:6a:42 brd ff:ff:ff:ff:ff:ffinet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000link/ether 52:54:00:c8:6a:42 brd ff:ff:ff:ff:ff:ff
2.系統軟件信息查看
2.1.系統名稱版本信息查看
uname -s:顯示系統出內核名稱
uname -a:顯示系統所有信息,包括系統類型、主機名稱、內核信息等
cat /etc/*release:查看系統名稱及其版本
1.Windows使用VMware安裝的Linux(Centos 7.6)后,查看系統所有信息,及詳細的系統名稱及其版本。
[root@localhost ~]# uname -s
Linux
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# ll /etc/*release
-rw-r--r--. 1 root root 38 Nov 23 2018 /etc/centos-release
-rw-r--r--. 1 root root 393 Nov 23 2018 /etc/os-release
lrwxrwxrwx. 1 root root 14 Dec 13 00:58 /etc/redhat-release -> centos-release
lrwxrwxrwx. 1 root root 14 Dec 13 00:58 /etc/system-release -> centos-release
[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
2.其他系統查看,如:華為的麒麟系統相關信息
[root@node2 ~]# uname -s
Linux
[root@node2 ~]# uname -a
Linux node2 4.19.90-23.8.v2101.ky10.aarch64 #1 SMP Mon May 17 17:07:38 CST 2021 aarch64 aarch64 aarch64 GNU/Linux
[root@n110 ~]# ll /etc/*release
-rw-r--r-- 1 root root 49 5月 18 2021 /etc/kylin-release
-rw-r--r-- 1 root root 180 10月 29 2020 /etc/lsb-release
-rw-r--r-- 1 root root 160 5月 18 2021 /etc/os-release
lrwxrwxrwx 1 root root 13 5月 18 2021 /etc/system-release -> kylin-release
[root@node2 ~]# cat /etc/kylin-release
Kylin Linux Advanced Server release V10 (Tercel)
2.2.系統內核版本信息查看
uname -r:顯示系統內核版本信息
1.Windows使用VMware安裝的Linux(Centos 7.6)后,查看系統的內核版本信息。
[root@localhost ~]# uname -r
3.10.0-957.el7.x86_64
2.其他內核信息查看,如:麒麟arm架構的系統內核。
[root@n110 ~]# uname -r
4.19.90-23.8.v2101.ky10.aarch64
2.3.系統位數查看
Windows使用VMware安裝的Linux(Centos 7.6)后,查看Linux服務器IP信息。
[root@localhost ~]# getconf LONG_BIT
64
2.4.系統文件目錄切換及查看
2.4.1.查看當前目錄內容
ls:列出文件和目錄
ls -l:-l指list,列出詳細信息
ll:ls -l的別名,與ls -l等價
ll -a:-a指all,顯示所有文件和目錄(包括隱藏文件和目錄)
1.Windows使用VMware安裝的Linux(Centos 7.6)后,通過ls、ls -l、ll、ll -a顯示當前目錄下的文件和目錄列表。
[root@localhost ~]# ls
anaconda-ks.cfg Desktop Documents Downloads Music original-ks.cfg Pictures Public Templates Videos
[root@localhost ~]# ls -l
total 8
-rw-------. 1 root root 2864 Dec 13 01:05 anaconda-ks.cfg
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Desktop
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Documents
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Downloads
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Music
-rw-------. 1 root root 2099 Dec 13 01:05 original-ks.cfg
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Pictures
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Public
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Templates
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Videos
[root@localhost ~]# ll
total 8
-rw-------. 1 root root 2864 Dec 13 01:05 anaconda-ks.cfg
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Desktop
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Documents
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Downloads
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Music
-rw-------. 1 root root 2099 Dec 13 01:05 original-ks.cfg
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Pictures
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Public
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Templates
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Videos
[root@localhost ~]# ll -a
total 72
dr-xr-x---. 15 root root 4096 Dec 23 23:33 .
dr-xr-xr-x. 17 root root 224 Dec 13 01:05 ..
-rw-------. 1 root root 2864 Dec 13 01:05 anaconda-ks.cfg
-rw-------. 1 root root 4494 Dec 23 20:15 .bash_history
-rw-r--r--. 1 root root 18 Dec 29 2013 .bash_logout
-rw-r--r--. 1 root root 176 Dec 29 2013 .bash_profile
-rw-r--r--. 1 root root 176 Dec 29 2013 .bashrc
drwx------. 14 root root 4096 Dec 15 23:27 .cache
drwxr-xr-x. 16 root root 4096 Dec 15 23:28 .config
-rw-r--r--. 1 root root 100 Dec 29 2013 .cshrc
drwx------. 3 root root 25 Dec 13 01:08 .dbus
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Desktop
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Documents
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Downloads
-rw-------. 1 root root 16 Dec 13 01:08 .esd_auth
-rw-------. 1 root root 9106 Dec 23 18:15 .ICEauthority
drwx------. 3 root root 19 Dec 13 01:08 .local
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Music
-rw-------. 1 root root 2099 Dec 13 01:05 original-ks.cfg
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Pictures
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Public
drwx------. 2 root root 25 Dec 17 01:31 .ssh
-rw-r--r--. 1 root root 129 Dec 29 2013 .tcshrc
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Templates
drwxr-xr-x. 2 root root 6 Dec 13 01:08 Videos
-rw-------. 1 root root 1018 Dec 13 01:25 .viminfo
-rw-------. 1 root root 536 Dec 21 22:29 .Xauthority
2.4.2.目錄切換
cd:切換目錄
1.Windows使用VMware安裝的Linux(Centos 7.6)后,cd Desktop,cd空格后沒有斜線(/),則為相對路徑目錄的切換。
[root@localhost ~]# cd Desktop/
[root@localhost Desktop]# ll
total 0
?2.cd /etc/sysconfig/network-scripts/,cd空格后有斜線(/),則為絕對路徑目錄的切換。
[root@localhost Desktop]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# ll
total 252
-rw-r--r--. 1 root root 486 Dec 23 18:23 ifcfg-ens33
... ...
2.4.3.文件查看
cat:顯示文件全部內容
grep:從文本文件或管道數據流中篩選匹配的行及數據(顯示文件匹配關鍵字的行)
vi:文本編輯器
1.Windows使用VMware安裝的Linux(Centos 7.6)后,可以之間cat 查看文件內容。適用于內容少的文件查看,如果文件過多,會全部輸出到屏幕,內容太多也不方便查看。
[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
2.可以使用grep查看文件帶有關鍵字IPADDR的行內容。
[root@localhost ~]# grep IPADDR /etc/sysconfig/network-scripts/ifcfg-ens33
IPADDR=192.168.118.201 # 靜態IP地址
3.使用vi進行簡單的文字編輯,見VMware安裝Linux(Centos 7.6)后網絡配置的"1.3.網絡配置"章節。
3.信息查看腳本
1.腳本下載地址。
https://download.csdn.net/download/Querycache/90151460
2.腳本執行效果。