我想grep主板序列号和计算机的产品型号。我用了
sudo lshw | grep -m1 serial:
grep序列号(因为多次出现“ serial:”,而我想要的是第一个。因此,我该如何同时对“ product:”进行grep呢?也有多次出现product,第一个又是我想要的那个
lshw
返回此:
user@ubuntu:~$ sudo lshw
ubuntu-pc
description: Notebook
product: 23252DG (LENOVO_MT_2325)
vendor: LENOVO
version: ThinkPad X230
serial: R9TWZVR
width: 64 bits
capabilities: smbios-2.7 dmi-2.7 vsyscall32
configuration: administrator_password=disabled chassis=notebook family=ThinkPad X230 power-on_password=disabled sku=LENOVO_MT_2325 uuid=01ECC0B1-8251-CB11-8538-B7D9EC435D9B
*-core
description: Motherboard
product: 23252DG
vendor: LENOVO
physical id: 0
version: Not Defined
serial: 1ZPAB2AC2C1
slot: Not Available
*-cpu
description: CPU
product: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
vendor: Intel Corp.
physical id: 1
bus info: cpu@0
version: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
serial: None
system
?我看不到中提到的内容man lshw
。我们可以确定-c system
始终显示主板详细信息,而没有其他信息吗?