Thursday, July 25, 2013

Các lệnh thông dụng xem thông tin phần cứng trên HĐH Linux

Đầu tiên là lệnh xem RAM
[root@localhost ~]#top
Tasks: 508 total, 1 running, 507 sleeping, 0 stopped, 0 zombie
Cpu(s): 4.7%us, 0.3%sy, 0.0%ni, 94.6%id, 0.4%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 8289408k total, 3601696k used, 4687712k free, 244176k buffers
Swap: 20482832k total, 0k used, 20482832k free, 1194508k cached

Tuy đây là lệnh dùng để xem các tiến trình nhưng nó cho chúng ta biết được lượng RAM của hệ thống, như trên là 8GB.

Thứ hai là lệnh xem CPU gì và tốc độ ra sao, có bao nhiêu nhân hay bao nhiêu CPU vật lý.
[root@localhost ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 44
model name : Intel(R) Xeon(R) CPU E5640 @ 2.67GHz
stepping : 2
cpu MHz : 1596.000
cache size : 12288 KB
physical id : 0
siblings : 8
core id : 0
cpu cores : 4
apicid : 0
...........................

Thứ ba là lệnh xem các thông tin của chipset của hệ thống
[root@localhost ~]# lspci
00:00.0 Host bridge: Intel Corporation 5520 I/O Hub to ESI Port (rev 22)
00:01.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 1 (rev 22)
00:03.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 3 (rev 22)
00:05.0 PCI bridge: Intel Corporation 5520/X58 I/O Hub PCI Express Root Port 5 (rev 22)
............................

Thứ 4 là lệnh các thông tin của mainboard thông tin serial của thiết bị:
[root@localhost ~]# dmidecode .type baseboard |more
# dmidecode 2.11
SMBIOS 2.5 present.
69 structures occupying 2751 bytes.
Table at 0x7F6BD000.

Handle 0x0000, DMI type 38, 16 bytes
IPMI Device Information
Interface Type: KCS (Keyboard Control Style)
Specification Version: 2.0
I2C Slave Address: 0x10
NV Storage Device: Not Present
Base Address: 0x0000000000000CA2 (I/O)

Handle 0x0001, DMI type 4, 40 bytes
Processor Information
Socket Designation: Node 1 Socket 1
Type: Central Processor
Family: Xeon MP
Manufacturer: Intel(R) Corporation
ID: C2 06 02 00 FF FB EB BF
Signature: Type 0, Family 6, Model 44, Stepping 2
............................................

Và một lệnh nữa cũng hay dùng để biết dung lượng các ổ cứng chúng ta có:
[root@localhost ~]# fdisk -l
Disk /dev/sda: 300.0 GB, 300000000000 bytes
255 heads, 63 sectors/track, 36472 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 637 5116671 83 Linux
/dev/sda2 638 36472 287844637+ 83 Linux

Disk /dev/sdb: 300.0 GB, 300000000000 bytes
255 heads, 63 sectors/track, 36472 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 2550 20482843+ 82 Linux swap / Solaris

Kiểm tra CPU:
cat /proc/cpuinfoKiểm tra tốc độ đọc ghi ổ cứng:dd if=/dev/zero of=1GB.tmp bs=1024 count=1M conv=fdatasync(kết quả ra 50MB là tạm chấp nhận được, >100MB là ngon, còn <50 tốt nhất bạn nên tìm nhà cung cấp khác)