CentOS系统中如何查看机器的具体信息和配置?

在CentOS系统中,查看机器的详细信息是进行系统管理和维护的重要步骤,以下是如何在CentOS中查看机器的各种信息,包括系统信息、硬件信息、网络信息等。

CentOS系统中如何查看机器的具体信息和配置?

系统信息查看

要查看CentOS系统的基本信息,可以使用以下命令:

  • cat /etc/os-release:查看操作系统版本和发行版信息。
  • uname -a:查看系统的内核版本和架构。
  • hostname:查看系统的主机名。
[root@centos ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
[root@centos ~]# uname -a
Linux centos 3.10.0-514.26.2.el7.x86_64 #1 SMP Thu Jan 7 15:47:27 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@centos ~]# hostname
centos

硬件信息查看

查看硬件信息可以帮助你了解机器的配置情况:

  • lspci:列出所有PCI设备。
  • lsusb:列出所有USB设备。
  • lsmod:列出当前加载的内核模块。
  • free -m:查看内存使用情况。
  • df -h:查看磁盘空间使用情况。
[root@centos ~]# lspci
00:00.0 Host bridge: Intel Corporation Xeon CPU E5-2680 v3 @ 2.50GHz
00:01.0 PCI bridge: Intel Corporation Xeon CPU E5-2680 v3 @ 2.50GHz
...
[root@centos ~]# lsusb
Bus 001 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
...
[root@centos ~]# lsmod
autofs4            4194304  0
...
[root@centos ~]# free -m
total used free shared buff/cache available
Mem: 3992 345 3650 0 273 3650
...
[root@centos ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1       50G  4.2G   45G  9% /
devtmpfs        1.9G  0     1.9G  0% /dev
tmpfs           1.9G  0     1.9G  0% /dev/shm
tmpfs           1.9G  0     1.9G  0% /run
tmpfs           1.9G  0     1.9G  0% /sys/fs/cgroup

网络信息查看

网络信息对于配置网络服务非常重要:

CentOS系统中如何查看机器的具体信息和配置?

  • ifconfig:查看网络接口配置。
  • ip addr:查看网络接口的IP地址。
  • netstat -tulnp:查看网络连接、监听端口和服务状态。
[root@centos ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.100  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::20c:29ff:fe7f:9e4f  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:7f:9e:4f  txqueuelen 1000  (Ethernet)
        RX packets 632698  bytes 71572240 (69.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 515950  bytes 44853760 (42.8 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        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
[root@centos ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default
    link/ether 00:0c:29:7f:9e:4f brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.100/24 brd 192.168.1.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe7f:9e4f/64 scope link 
       valid_lft forever preferred_lft forever
[root@centos ~]# netstat -tulnp
Active Internet Connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 192.168.1.100:22      0.0.0.0:*               LISTEN      842/sshd

FAQs

Q1:如何查看CentOS的CPU信息?

A1: 使用cat /proc/cpuinfo命令可以查看CPU的详细信息,包括型号、速度、核心数等。

[root@centos ~]# cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 63
model name      : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
stepping        : 2
microcode       : 0x410c0a0a
cpu MHz         : 2499.988
cache size      : 20480 KB
physical id     : 0
core id         : 0
cpu cores       : 8
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx upat lahf3 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer cpuid xsave avx f16c rdrand lahf_lm xsaveopt
bogomips        : 4999.99
clflush size    : 64
power management:

Q2:如何查看CentOS的内存信息?

CentOS系统中如何查看机器的具体信息和配置?

A2: 使用free -m命令可以查看内存的使用情况,包括总内存、已用内存、可用内存等。

[root@centos ~]# free -m
total used free shared buff/cache available
Mem: 3992 345 3650 0 273 3650

【版权声明】:本站所有内容均来自网络,若无意侵犯到您的权利,请及时与我们联系将尽快删除相关内容!

赞 (0)
热舞的头像热舞
上一篇 2026-01-24 23:36
下一篇 2026-01-24 23:39

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

广告合作

QQ:14239236

在线咨询: QQ交谈

邮件:asy@cxas.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信