背景
想看内存是 DDR 几的,用 lshw
命令都看不到:
$ sudo lshw -html > /tmp/index.html
利用 firefox
打开 index.html 文件看了半天没看到有 DDR 的说明。
dmidecode
非常感谢@向东博客的 LINUX下如何查看内存品牌和速率啊? 一文。在文章里面介绍了名为 dmidecode
的工具。DMI 表示的是 Desktop Management Interface 桌面管理接口,使用 dmidecode
工具可以查询很多 DMI 表的信息,包括内存,主板等。
安装
-
CentOS 7 安装
dmidecode
$ sudo yum install -y dmidecode
-
Ubuntu 14.04 安装
dmidecode
$ sudo apt-get install -y dmidecode
使用
-
查看内存槽及内存条:
$ sudo dmidecode -t memory
-
查看内存的插槽数,已经使用多少插槽.每条内存多大:
$ sudo dmidecode -t memory | grep Size
-
查看服务器型号、序列号:
$ sudo dmidecode | grep "System Information" -A9 | egrep "Manufacturer|Product|Serial"