Linux 命令行中查看系统信息的综合指南140
在 Linux 操作系统中,获取有关系统配置、硬件信息、进程活动和资源利用率等详细信息至关重要。通过利用各种命令行工具,系统管理员和用户可以深入了解系统并诊断问题。
本指南将深入探讨 Linux 中用于查看系统信息的常用命令,并提供实用示例,帮助您高效地获取所需信息。以下是涵盖的命令:
uname
hostname
cat /proc/version
lscpu
free
vmstat
top
ps
df
iostat
netstat
ifconfig
iwconfig
dmesg
last
1. uname
用途:获取有关系统内核和操作系统版本的详细
示例:
```
$ uname -a
Linux hostname 4.15.0-1046-aws #21 SMP Wed May 29 17:37:23 UTC 2019 x86_64 GNU/Linux
```
2. hostname
用途:获取系统的名称
示例:
```
$ hostname
hostname
```
3. cat /proc/version
用途:显示内核版本和编译选项
示例:
```
$ cat /proc/version
Linux version 4.15.0-1046-aws (builder@) (gcc version 7.3.1 20180324 (Red Hat 7.3.1-5)) #21 SMP Wed May 29 17:37:23 UTC 2019
```
4. lscpu
用途:显示 CPU 信息,包括架构、内核数量和缓存大小
示例:
```
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 39 bits physical, 48 bits virtual
CPU(s): 24
On-line CPU(s) list: 0-23
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 2
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 63
Model name: Intel(R) Xeon(R) Gold 5218R CPU @ 2.10GHz
Stepping: 4
CPU max MHz: 2700.0000
CPU min MHz: 1200.0000
BogoMIPS: 4200.00
Virtualization: VT-x
L1d cache: 32 KiB
L1i cache: 32 KiB
L2 cache: 1024 KiB
L3 cache: 25600 KiB
NUMA node0 CPU(s): 0-23
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid ssbd cx16rt avx xsave avx2 rdseed lwp f16c rdpid fsgsbase tsc_adjust bmi1 avx512f avx512dq rdtscp_msb ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hwp_pkg_resp avx512ifma avx512er msr_safe avx512cd clwb sha_ni rdpid3
```
5. free
用途:显示系统内存使用情况
示例:
```
$ free
total used free shared buff/cache available
Mem: 15669672 4664552 9907920 3392 1048228 10878496
Swap: 2096516 0 2096516
```
6. vmstat
用途:显示虚拟内存统计信息,包括页面交换和 CPU 使用情况
示例:
```
$ vmstat 1
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 494400 9892284 1048228 10843840 0 0 0 0 149 3262 0 0 0 0 0
```
7. top
用途:交互式地显示正在运行的进程和资源使用情况
示例:
```
$ top
top - 17:31:10 up 24 days, 11:49, 2 users, load average: 0.28, 0.35, 0.36
Tasks: 170 total, 1 running, 169 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.3 us, 0.3 sy, 0.0 ni, 99.4 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 15669.6 total, 10016.2 free, 1975.7 used, 4647.7 buff/cache
MiB Swap: 2096.5 total, 2096.5 free, 0.0 used. 10295.2 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 20 0 3318600 39240 29020 S 0.0 0.3 0:05.75 systemd
102 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
103 root 20 0 0 0 0 S 0.0 0.0 0:00.33 rcu_gp
104 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_par_gp
105 root 20 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
106 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
107 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/1
108 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/2
109 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/3
110 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/4
111 root RT 0 0 0 0 S 0.0 0.0
2024-11-02
新文章

Windows 7系统迁移:完整指南及专业级技巧

Windows系统封装:从零到精通的专业指南

从Windows到macOS:操作系统架构与迁移的可能性及挑战

鸿蒙系统充电89%背后的操作系统机制与优化策略

iOS系统架构及应用开发安全机制详解

华为平板采用HarmonyOS还是Android?操作系统技术深度解析

深入Android系统:启动流程、访问权限与安全机制

Linux系统告警监控与排查详解

诺基亚Windows Phone系统版本及生态系统分析

鸿蒙3.0操作系统深度解析:架构、特性及未来展望
热门文章

iOS 系统的局限性

Linux USB 设备文件系统

Mac OS 9:革命性操作系统的深度剖析

华为鸿蒙操作系统:业界领先的分布式操作系统

**三星 One UI 与华为 HarmonyOS 操作系统:详尽对比**

macOS 直接安装新系统,保留原有数据

Windows系统精简指南:优化性能和提高效率
![macOS 系统语言更改指南 [专家详解]](https://cdn.shapao.cn/1/1/f6cabc75abf1ff05.png)
macOS 系统语言更改指南 [专家详解]

iOS 操作系统:移动领域的先驱
