Linux 查看系統硬件信息彙總 (部份實例詳解Centoso爲例)

Linux 查看系統硬件信息彙總 (部份實例詳解Centoso爲例)
1.cpu

查看CPU信息

總核數 = 物理CPU個數 X 每顆物理CPU的核數

總邏輯CPU數 = 物理CPU個數 X 每顆物理CPU的核數 X 超線程數

查看物理CPU個數

cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l

查看每個物理CPU中core的個數(即核數)

cat /proc/cpuinfo| grep "cpu cores"| uniq

查看邏輯CPU的個數

cat /proc/cpuinfo| grep "processor"| wc -l

查看CPU信息(型號)

cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c

#lscpu命令,查看的是cpu的統計信息.(部分舊版本不支持)

複製代碼
Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000859f

Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 7833 62401536 8e Linux LVM

Disk /dev/mapper/vg_qdy-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
複製代碼

使用#cat /proc/cpuinfo ,可以知道每個cpu信息,如每個CPU的型號,主頻等。

2.內存

#free -m # 查看內存使用量和交換區使用量

total used free shared buffers cached
Mem: 3690 288 3401 0 15 119
-/+ buffers/cache: 153 3536
Swap: 3951 0 3951

cat /proc/meminfo

#dmidecode -t memory 查看內存硬件信息

grep MemTotal /proc/meminfo# 查看內存總量

grep MemFree /proc/meminfo # 查看空閒內存量

lsmod # 列出加載的內核模塊

3.磁盤

lsblk 查看硬盤與分區分而

View Code

#df -h # 查看各分區使用情況

#du -sh # 查看指定目錄的大小

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_qdy-lv_root 50G 3.7G 44G 8% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 485M 39M 421M 9% /boot
/dev/mapper/vg_qdy-lv_home 5.6G 239M 5.1G 5% /home
#fdisk -l # 查看所有分區詳細信息

複製代碼
Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000859f
Device Boot Start End Blocks Id System
/dev/sda1
1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 7833 62401536 8e Linux LVM
Disk /dev/mapper/vg_qdy-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
...... 下方省略!
複製代碼

4.網卡信息

lspci | grep -i 'eth' 查看網卡硬件信息

ifconfig -a 查看系統所有網絡接口

或 #ip link show

ethtool eth0 查看某個網絡接口的詳細信息

5.主板所有硬件槽PCI信息。

#lspci

更詳細的lspci -v 或者 lspci -vv

#lscpi -t 設備樹

6.查看bios 信息

dmidecode -t bios

  1. 查看系統運行時間、用戶數、負載

#uptime

#cat /proc/loadavg # 查看系統負載磁盤和分區

  1. 查看掛接的分區狀態

#mount | column -t

  1. 查看系統負載 磁盤和分區

cat /proc/loadavg

10.查看所有安裝的軟件包

#rpm -qa

  1. 查看所有進程

ps -ef

  1. 查看所有監聽端口

#netstat -lntp

13.查用戶與組信息

#cut -d: -f1 /etc/passwd # 查看系統所有用戶 cat /etc/passwd |more 顯示長系統用戶並分頁

#cut -d: -f1 /etc/group # 查看系統所有組 cat /etc/group|more 顯示長系統所有組並分頁

14其它不常用查看信息命令

swapon -s # 查看所有交換分區

iptables -L # 查看防火牆設置

hdparm -i /dev/hda # 查看磁盤參數(僅適用於IDE設備)

dmesg | grep IDE # 查看啓動時IDE設備檢測狀況網絡

crontab -l # 查看當前用戶的計劃任務 服務

chkconfig –list # 列出所有系統服務#

chkconfig –list | grep on # 列出所有啓動的系統服務 程序

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章