一 hostname:显示和设置系统主机的名。
(1)选项:
*-a:显示主机的别名。
*-i:显示指定主机的ID地址。
二 uname:print system information。
*-a:print all information.
*-s:print kernel name.
*-v:print the kernel version.
三 综合:
(1)打印出CPU相关信息:
cat /proc/cpuinfo
第五行为cpu的名称:cat /proc/cpuinfo | head -n 5 | tail -1
(2)打印内存的详细信息:
cat /proc/meminfo
(3)打印系统分区信息:
cat /proc/partitions
或fdisk命令。
(4)获取系统的详细信息:
lshw:lshw is a small tool to extract detailed information on the hardware configuration of the machine.

本文介绍如何使用hostname、uname等命令查询Linux系统的基本信息,并通过cat命令读取/proc/cpuinfo、/proc/meminfo和/proc/partitions来获取CPU、内存及磁盘分区详情。

1万+

被折叠的 条评论
为什么被折叠?



