Linux 系统检查指南118


Linux 操作系统以其稳定性、安全性、可定制性和开源特性而闻名。为了保持系统的正常运行,定期检查至关重要。本文将介绍各种命令和工具,帮助您全面检查您的 Linux 系统。

系统信息

uname -a 命令提供有关系统核心的信息,包括版本号、处理器类型和发行版。
$ uname -a
Linux hostname 5.15.0-43-generic #46~20.04.1-Ubuntu SMP Wed Aug 18 14:40:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

cat /etc/os-release 命令显示有关操作系统的发行版和版本的信息。
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="/"
SUPPORT_URL="/"
BUG_REPORT_URL="/ubuntu/"
PRIVACY_POLICY_URL="/legal/terms-and-conditions"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

hostnamectl 命令提供有关系统主机名、静态主机名、虚拟化系统和内核版本的信息。
$ hostnamectl
Static hostname: hostname
Icon name: computer-vm
Chassis: vm
Machine ID: a6f620e277a676719c82379413c7e2bb
Boot ID: dc7f48da1305424689dd853e9c0cb12d
Operating System: Ubuntu 20.04.3 LTS
Kernel: Linux 5.15.0-43-generic
Architecture: x86-64

硬件信息

lspci 命令列出系统中的 PCI 设备及其详细信息。
$ lspci
00:00.0 Host bridge: Intel Corporation 5 Series/3400 Series Chipset PCIe Root Port 1
00:01.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCIe Root Port 2
00:14.0 USB controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller
00:16.0 Communication controller: Intel Corporation 5 Series/3400 Series Chipset HECI Controller
00:1c.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCIe Root Port 6
00:1d.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCIe Root Port 7
00:1f.0 ISA bridge: Intel Corporation HM55 Chipset LPC Interface Controller
00:1f.2 SATA controller: Intel Corporation 5 Series/3400 Series Chipset SATA RAID Controller
00:1f.3 SMBus: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller
00:1f.6 Signal processing controller: Intel Corporation 5 Series/3400 Series Chipset Thermal Management Controller

lshw 命令提供有关系统硬件的详细报告,包括 CPU、内存、磁盘、网络设备和 USB 设备。
$ lshw
*-core
description: Core 0
product: Xeon E5-2630 v3
vendor: Intel Corp.
physical id: 0
bus info: cpu@0
version: Intel(R) Core(TM) i7-7940X CPU @ 3.10GHz
capacity: 6400 MHz
width: 64 bits
capabilities: x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 sse3 ssse3 sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_prefetch_hint intel_pt ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt cqm tpr_shadow_pb spec_ctrl pku ospke vaes pcid_alloc
configuration: addressrange=0xa4000000-0xa8ffffff
resources: irq:56 memory:a4000000-a8ffffff
*-core
description: Core 1
product: Xeon E5-2630 v3
vendor: Intel Corp.
physical id: 1
bus info: cpu@0
version: Intel(R) Core(TM) i7-7940X CPU @ 3.10GHz
capacity: 6400 MHz
width: 64 bits
capabilities: x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 sse3 ssse3 sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_prefetch_hint intel_pt ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt cqm tpr_shadow_pb spec_ctrl pku ospke vaes pcid_alloc
configuration: addressrange=0xa9000000-adffffff
resources: irq:57 memory:a9000000-adffffff

进程信息

ps aux 命令显示系统中当前正在运行的所有进程,包括它们的 PID、用户、CPU 使用率、内存使用率、启动时间和命令行。
$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 25880 4836 ? Ssl Aug19 0:10 /sbin/init
root 2 0.0 0.0 248 80 ? S Aug19 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S Aug19 0:00 [migration/0]
root 5 0.0 0.0 0 0 ? S Aug19 0:00 [idle_cpu.0]
root 6 0.0 0.0 0 0 ? S Aug19 0:00 [idle_cpu.1]

top 命令提供有关系统资源使用的实时视图,包括 CPU 使用率、内存使用率、进程列表和系统活动。
$ top
top - 23:42:02 up 11 days, 4:38, 1 user, load average: 0.12, 0.10, 0.08
Tasks: 258 total, 1 running, 257 sleeping, 0 stopped, 0 zombie
%Cpu(s): 1.0 us, 0.3 sy, 0.0 ni, 98.6 id, 0.0 wa, 0.0 hi, 0.1 si, 0.0 st
MiB Mem : 15789.4 total, 8987.1 free, 6802.3 used, 2672.0 buff/cache
MiB Swap: 2047.9 total, 2047.9 free, 0.0 used.
PID USER PR NI VIRT RES SHR S %CPU %MEM

2024-12-31


上一篇:iOS 系统:移动操作系统的典范

下一篇:华为鸿蒙系统揭秘:移动操作系统的新篇章

新文章
Android系统框架深度解析:从Linux内核到应用层的全景图
Android系统框架深度解析:从Linux内核到应用层的全景图
1分钟前
iOS系统升级至iOS 14深度解析:从准备到故障排除的全方位指南
iOS系统升级至iOS 14深度解析:从准备到故障排除的全方位指南
5分钟前
深度解析鸿蒙OS后台管理机制:告别“杀后台”,还是智能资源调度新典范?
深度解析鸿蒙OS后台管理机制:告别“杀后台”,还是智能资源调度新典范?
10分钟前
华为鸿蒙系统手机深度解析:分布式OS的演进与未来
华为鸿蒙系统手机深度解析:分布式OS的演进与未来
20分钟前
Linux系统安装专业指南:从准备到优化,全面掌握操作系统部署
Linux系统安装专业指南:从准备到优化,全面掌握操作系统部署
23分钟前
华为鸿蒙系统:从『学不会』的迷思到分布式架构的深度解析
华为鸿蒙系统:从『学不会』的迷思到分布式架构的深度解析
29分钟前
深度解析iOS降级机制:安全、签名与系统架构的挑战
深度解析iOS降级机制:安全、签名与系统架构的挑战
34分钟前
深入解析Linux字体管理:从添加安装到个性化渲染优化
深入解析Linux字体管理:从添加安装到个性化渲染优化
38分钟前
HarmonyOS 2.0在华为Nova 7上的深度解析:分布式操作系统的前瞻与实践
HarmonyOS 2.0在华为Nova 7上的深度解析:分布式操作系统的前瞻与实践
51分钟前
Linux系统深度解析:从内核到应用的全景透视
Linux系统深度解析:从内核到应用的全景透视
1小时前
热门文章
iOS 系统的局限性
iOS 系统的局限性
12-24 19:45
Linux USB 设备文件系统
Linux USB 设备文件系统
11-19 00:26
Mac OS 9:革命性操作系统的深度剖析
Mac OS 9:革命性操作系统的深度剖析
11-05 18:10
华为鸿蒙操作系统:业界领先的分布式操作系统
华为鸿蒙操作系统:业界领先的分布式操作系统
11-06 11:48
**三星 One UI 与华为 HarmonyOS 操作系统:详尽对比**
**三星 One UI 与华为 HarmonyOS 操作系统:详尽对比**
10-29 23:20
macOS 直接安装新系统,保留原有数据
macOS 直接安装新系统,保留原有数据
12-08 09:14
Windows系统精简指南:优化性能和提高效率
Windows系统精简指南:优化性能和提高效率
12-07 05:07
macOS 系统语言更改指南 [专家详解]
macOS 系统语言更改指南 [专家详解]
11-04 06:28
iOS 操作系统:移动领域的先驱
iOS 操作系统:移动领域的先驱
10-18 12:37
华为鸿蒙系统:全面赋能多场景智慧体验
华为鸿蒙系统:全面赋能多场景智慧体验
10-17 22:49