linux查看系统相关信息
一、查看Linux内核版本信息:
常用的三个命令
$cat /proc/version
1 | Linux version 4.15.0-144-generic (buildd@lgw01-amd64-031) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #148-Ubuntu SMP Sat May 8 |
02:33:43 UTC 2021
$uname -a
1 | Linux aiserver 4.15.0-144-generic #148-Ubuntu SMP Sat May 8 02:33:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux |
$lsb_release -a
1 2 3 4 5 | No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.5 LTS Release: 18.04 Codename: bionic |
二、查看硬件信息:
CPU
lscpu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 72 On-line CPU(s) list: 0-71 Thread(s) per core: 2 Core(s) per socket: 18 Socket(s): 2 NUMA node(s): 2 Vendor ID: GenuineIntel CPU family: 6 Model: 85 Model name: Intel(R) Xeon(R) Gold 5220 CPU @ 2.20GHz Stepping: 7 CPU MHz: 1000.041 BogoMIPS: 4400.00 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 1024K L3 cache: 25344K NUMA node0 CPU(s): 0,2,4,6... NUMA node1 CPU(s): 1,3,5,7... Flags: fpu vme de pse ts... |
硬盘
lsblk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 10.9T 0 disk ├─sda1 8:1 0 512M 0 part /boot/efi ├─sda2 8:2 0 1G 0 part /boot └─sda3 8:3 0 10.9T 0 part ├─ubuntu--vg-ubuntu--lv 253:3 0 800G 0 lvm / ├─ubuntu--vg-lv--0 253:4 0 10T 0 lvm /home └─ubuntu--vg-lv--1 253:5 0 32G 0 lvm [SWAP] sdb 8:16 0 446.6G 0 disk ├─sdb1 8:17 0 200M 0 part ├─sdb2 8:18 0 1G 0 part └─sdb3 8:19 0 445.4G 0 part ├─centos-swap 253:0 0 4G 0 lvm ├─centos-home 253:1 0 391.4G 0 lvm /media/xy/263a154c-0287-4756-9c15-2d1f5a91414b └─centos-root 253:2 0 50G 0 lvm |
df 命令显示文件系统的磁盘空间使用情况
df -h
1 2 3 4 5 6 7 8 9 10 11 12 13 | Filesystem Size Used Avail Use% Mounted on udev 126G 0 126G 0% /dev tmpfs 26G 3.8M 26G 1% /run /dev/mapper/ubuntu--vg-ubuntu--lv 800G 535G 266G 67% / tmpfs 126G 0 126G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 126G 0 126G 0% /sys/fs/cgroup /dev/mapper/ubuntu--vg-lv--0 10T 189G 9.9T 2% /home /dev/sda2 976M 156M 754M 18% /boot /dev/sda1 511M 6.7M 505M 2% /boot/efi tmpfs 26G 16K 26G 1% /run/user/125 tmpfs 26G 64K 26G 1% /run/user/1000 /dev/mapper/centos-home 392G 33M 392G 1% /media/xy/263a154c-0287-4756-9c15-2d1f5a91414b |
网卡
ifconfig 是一个用于配置和显示网络接口信息的命令。
ifconfig
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255 ether 02:42:ca:e4:bd:8a txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eno1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether 78:ac:44:3b:64:90 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eno2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.110.245 netmask 255.255.255.0 broadcast 192.168.110.255 inet6 fe80::85e8:6c5a:e921:30a3 prefixlen 64 scopeid 0x20<link> ether 78:ac:44:3b:64:91 txqueuelen 1000 (Ethernet) RX packets 3540773 bytes 2126914498 (2.1 GB) RX errors 0 dropped 22614 overruns 0 frame 0 TX packets 10399174 bytes 5724353324 (5.7 GB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 <strong>ip addr show eth0或ip addr show</strong> 3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 78:ac:44:3b:64:91 brd ff:ff:ff:ff:ff:ff inet 192.168.110.245/24 brd 192.168.110.255 scope global noprefixroute eno2 valid_lft forever preferred_lft forever inet6 fe80::85e8:6c5a:e921:30a3/64 scope link noprefixroute valid_lft forever preferred_lft forever |
显卡
sudo apt-get install lshw
sudo lshw -C display
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | *-display description: VGA compatible controller product: Integrated Matrox G200eW3 Graphics Controller vendor: Matrox Electronics Systems Ltd. physical id: 0 bus info: pci@0000:03:00.0 version: 04 width: 32 bits clock: 66MHz capabilities: pm vga_controller bus_master cap_list rom configuration: driver=mgag200 latency=64 maxlatency=32 mingnt=16 resources: irq:16 memory:91000000-91ffffff memory:92808000-9280bfff memory:92000000-927fffff memory:c0000-dffff *-display description: 3D controller product: NVIDIA Corporation vendor: NVIDIA Corporation physical id: 0 bus info: pci@0000:3b:00.0 version: a1 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress bus_master cap_list configuration: driver=nvidia latency=0 resources: iomemory:38b00-38aff iomemory:38b80-38b7f irq:378 memory:ab000000-abffffff memory:38b000000000-38b7ffffffff memory:38b800000000-38b801ffffff |
nvidia-smi 命令(针对 NVIDIA 显卡)
sudo ubuntu-drivers autoinstall
nvidia-smi
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Mon Mar 10 15:56:39 2025 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 418.197.02 Driver Version: 418.197.02 CUDA Version: 10.1 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 Tesla V100S-PCI... Off | 00000000:3B:00.0 Off | 0 | | N/A 39C P0 27W / 250W | 0MiB / 32480MiB | 0% Default | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | No running processes found | +-----------------------------------------------------------------------------+ |
rocm-smi AMD 显卡
三、系统资源监控
top 和 htop,可以显示 CPU 的使用率、进程列表等信息,htop需要安装
sudo apt-get install htop
Comments are currently closed.