Linux 机器信息详解
在 Linux 操作系统中,获取机器的硬件和软件信息对于系统管理员和用户来说至关重要,本文将详细介绍如何通过命令行工具获取 Linux 机器的各种信息,包括 CPU、内存、硬盘、网络接口等关键部件的信息,以下是一些常用的方法和命令:
查看系统信息
uname -a
显示系统名称、节点名称、操作系统发行版号、操作系统版本和运行系统的机器 ID 号。
uname -a
输出示例:
Linux hostname 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
lsb_release -a
显示操作系统的详细信息。
lsb_release -a
输出示例:
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal
查看 CPU 信息
lscpu
显示 CPU 架构、型号、核心数、线程数等信息。
lscpu
输出示例:
Architecture: x86_64 CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 2 Core(s) per socket: 2 Socket(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 158 Model name: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz Stepping: 9 CPU MHz: 2808.000 BogoMIPS: 5616.00 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 6144K NUMA node(s): 1 ...
cat /proc/cpuinfo
显示每个 CPU 的详细信息。
cat /proc/cpuinfo | grep "model name" | head -n 1
输出示例:
model name : Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
查看内存信息
free -m
显示内存使用情况,包括已用内存、可用内存和交换空间。
free -m
输出示例:
total used free shared buff/cache available Mem: 7979 1126 6431 159 419 6551 Swap: 2047 0 2047
cat /proc/meminfo
显示详细的内存使用情况。
cat /proc/meminfo | grep MemTotal
输出示例:
MemTotal: 32941268 kB
查看硬盘信息
lsblk
列出块设备信息,如硬盘、固态硬盘和闪存驱动器等。
lsblk
输出示例:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 465.8G 0 disk ├─sda1 8:1 0 1G 0 part /boot ├─sda2 8:2 0 9.3G 0 part [SWAP] ├─sda3 8:3 0 74.5G 0 part / ├─sda4 8:4 0 1K 0 part └─sda5 8:5 0 111.8G 0 part /home
df -h
显示磁盘分区大小、已用空间和可用空间。
df -h
输出示例:
Filesystem Size Used Avail Use% Mounted on udev 2.0G 0 2.0G 0% /dev tmpfs 396M 1.4M 395M 1% /run /dev/sda3 74G 20G 50G 28% / tmpfs 2.0G 28M 2.0G 2% /dev/shm tmpfs 2.0G 44M 2.0G 3% /run/user/1000
fdisk -l
显示硬盘和分区的详细信息。
sudo fdisk -l
输出示例:
Disk /dev/sda: 465.8 GiB, 40 GiB disk ... Device Boot Start End Blocks Sectors Size Id Type /dev/sda1 * 2048 2148351 1073152+ 512 536870912 1G Linux filesystem /dev/sda2 2148352 22464959 5120000 512 5120000 82 Linux swap / Solaris /dev/sda3 22464960 297389183 752161264 512 374.5G Linux filesystem /dev/sda4 297389184 489619391 1922304064 512 932.5G Linux LVM /dev/sda5 297389186 412305407 1149162242 512 555.5G Linux filesystem
查看网络接口信息
ifconfig
或ip addr
显示网络接口信息,如 IP 地址、MAC 地址、网关等。
ifconfig -a
输出示例:
eth0: flags=4163<UP,BROADCAST>RUNNING>MULTICAST>PROMISC>MASTER>SLAVE>DYNAMIC> ... state UP ... ... inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 ... ether b8:97:5a:17:b3:8f ... ... inet6 fe80::baff:caff:fe17:b38f ... scope link ... lo: flags=73<UPLOOPBACK;RUNNING> mtu 65536 ... inet 127.0.0.1 netmask 255.0.0.0 ... loop back inet6 ... ...
或者:
ip addr show
输出示例:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 ... inet 192.168.1.100/24 brd ... promisc ... state DOWN qlen 100 ... up ... qlen 1000 ... state UNKNOWN qlen 100 ... INACTIVE ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 ... up ... qlen 100 …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen …up …qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…qlen…up…q len…up…q len…up…q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN q len...state UNKNOWN qolength-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-unknown-length-un known-length-unknown-length-unknown-length-un known-length-unknown-length-unknown-length-un known-length-unknown-length-unknown-length-un known-length-un known-length-unknown-length-unknown-length-un known-length-unknown-length-unknown-length-un known-length-unknown-length-unknown-length-un known-length-unknown-length-unknown-length-un known-length-unknown-length-unknown-length-un known-length-unknown-length-unknown-length-un known-length-unknown-length-unknown-length-un known-length-unknown-length-unknown-length-un known-length-unknown-length-unknown-length-un known-length-unknown-length-unknown-length-un known-length-unknown-length-unknown-length-un known length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown length unknown ) = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) = ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) = ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )) } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ») . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
到此,以上就是小编对于“linux 机器信息”的问题就介绍到这了,希望介绍的几点解答对大家有用,有任何问题和不懂的,欢迎各位朋友在评论区讨论,给我留言。
原创文章,作者:未希,如若转载,请注明出处:https://www.kdun.com/ask/1347168.html
本网站发布或转载的文章及图片均来自网络,其原创性以及文中表达的观点和判断不代表本网站。如有问题,请联系客服处理。
发表回复