Xem thông tin phần cứng trên máy dùng Linux

Bài viết này sẽ giúp bạn thu thập thông tin về các phần cứng của chiếc máy tính bạn đang sử dụng như CPU, RAM, HDD (ổ cứng), card mạng, card âm thanh…

1. lshw

lệnh này sẽ liệt kê tất cả thông tin về phần cứng trên máy bạn. lshw có thể hiểu là list hardware – liệt kê phần cứng. Thông tin khá nhiều nên bạn có thể dùng đầu ra của lệnh này làm đầu vào cho lệnh less để xem dễ hơn.


hvnsweeting@hvnbox:~$ lshw | less
kết quả trả về:

hvnbox
description: Computer
width: 32 bits
*-core
description: Motherboard
physical id: 0
*-memory
description: System memory
physical id: 0
size: 1885MiB
*-cpu
product: AMD Athlon(tm) 64 X2 Dual Core Processor 4000+
vendor: Advanced Micro Devices [AMD]



thông tin rất đầy đủ và chi tiết. Lệnh này còn cho phép trả về thông tin của 1 số class (lớp) phần cứng. Ví dụ


hvnsweeting@hvnbox:~$ lshw -C network

WARNING: you should run this program as super-user.
*-network
description: Ethernet interface
product: RTL8111/8168B PCI Express Gigabit Ethernet controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:02:00.0
logical name: eth0
version: 01
serial: 00:1b:fc:70:d6:d5
width: 64 bits
clock: 33MHz
capabilities: bus_master cap_list rom ethernet physical
configuration: broadcast=yes driver=r8169 driverversion=2.3LK-NAPI ip=192.168.1.101 latency=0 multicast=yes
resources: irq:25 ioport:ee00(size=256) memory:fdfff000-fdffffff memory:fdc00000-fdc1ffff

trả về thông tin về các card mạng, driver của chúng…

2. uname -a
lệnh này in ra terminal các thông tin về hệ thống (tên máy, thông tin về kernel, kiến trúc vi xử lý, hệ điều hành)


hvnsweeting@hvnbox:~$ uname -a

Linux hvnbox2.6.34-020634-generic #020634 SMP Mon May 17 20:34:55 UTC 2010i686 GNU/Linux

3. lsb_release -a
in ra thông tin cụ thể về distro đang dùng.

LSB = Linux Standard Base


hvnsweeting@hvnbox:~$ lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 10.10
Release: 10.10
Codename: maverick

4. dmesg | grep blocks
Trả về cỡ của HDD (ổ cứng) . Thực chất dmesg là một công cụ giúp người dùng lấy các thông tin lúc máy tính khởi động. Trường hợp này ta dùng grep để lọc ra thông tin về ổ cứng. Có thể nói đây là 1 cách làm gián tiếp nhưng hiệu quả bởi nhiều công cụ chuyên thao tác với ổ đĩa không trả về kích thước ổ cứng của bạn (df -h hay fdisk -l…)


hvnsweeting@hvnbox:~$ dmesg | grep blocks

[ 2.392356] sd 2:0:0:0: [sda] 976773168 512-byte logical blocks: (500 GB/465 GiB)

5. Xem đầy đủ thông tin về ổ cứng / view harddisk infomation


Dùng lệnh: trong terminal gõ sudo hdparm -i /dev/sda

kết quả trả về


/dev/sda:

ATA device, with non-removable media
Model Number: Hitachi HTS543232A7A384
Serial Number: E2034243F420AJ
Firmware Revision: ES2OA60W
Transport: Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6; Revision: ATA8-AST T13 Project D1697 Revision 0b
Standards:
Used: unknown (minor revision code 0×0028)
Supported: 8 7 6 5
Likely used: 8
Configuration:
Logical max current
cylinders 16383 16383
heads 16 16
sectors/track 63 63

CHS current addressable sectors: 16514064
LBA user addressable sectors: 268435455
LBA48 user addressable sectors: 625142448
Logical/Physical Sector size: 512 bytes
device size with M = 1024*1024: 305245 MBytes
device size with M = 1000*1000: 320072 MBytes (320 GB)
cache/buffer size = 8192 KBytes (type=DualPortCache)
Form Factor: 2.5 inch
Nominal Media Rotation Rate: 5400
Capabilities:
LBA, IORDY(can be disabled)
Queue depth: 32
Standby timer values: spec’d by Vendor, no device specific minimum
R/W multiple sector transfer: Max = 16 Current = 16
Advanced power management level: 254
DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4
Cycle time: no flow control=120ns IORDY flow control=120ns
Commands/features:
Enabled Supported:
* SMART feature set
Security Mode feature set
* Power Management feature set
* Write cache
* Look-ahead
* Host Protected Area feature set
* WRITE_BUFFER command
* READ_BUFFER command
* NOP cmd
* DOWNLOAD_MICROCODE
* Advanced Power Management feature set
Power-Up In Standby feature set
* SET_FEATURES required to spinup after power up
SET_MAX security extension
* 48-bit Address feature set
* Device Configuration Overlay feature set
* Mandatory FLUSH_CACHE
* FLUSH_CACHE_EXT
* SMART error logging
* SMART self-test
* General Purpose Logging feature set
* WRITE_{DMA|MULTIPLE}_FUA_EXT
* 64-bit World wide name
* IDLE_IMMEDIATE with UNLOAD
* WRITE_UNCORRECTABLE_EXT command
* {READ,WRITE}_DMA_EXT_GPL commands
* Segmented DOWNLOAD_MICROCODE
* Gen1 signaling speed (1.5Gb/s)
* Gen2 signaling speed (3.0Gb/s)
* Native Command Queueing (NCQ)
* Host-initiated interface power management
* Phy event counters
* NCQ priority information
Non-Zero buffer offsets in DMA Setup FIS
* DMA Setup Auto-Activate optimization
Device-initiated interface power management
In-order data delivery
* Software settings preservation
* SMART Command Transport (SCT) feature set
* SCT LBA Segment Access (AC2)
* SCT Error Recovery Control (AC3)
* SCT Features Control (AC4)
* SCT Data Tables (AC5)
Security:
Master password revision code = 65534
supported
not enabled
not locked
frozen
not expired: security count
supported: enhanced erase
86min for SECURITY ERASE UNIT. 88min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 5000cca690ec1f8b
NAA : 5
IEEE OUI : 000cca
Unique ID : 690ec1f8b
Checksum: correct

Có thể dùng grep để lấy thông tin cần thiết, ví dụ bạn cần lấy size của cache

sudo hdparm -I /dev/sda | grep cache

kểt quả trả về


cache/buffer size = 8192 KBytes (type=DualPortCache)
* Write cache

Cách dùng đầy đủ, gõ man hdparm trong terminal.
Reactions

Post a Comment

0 Comments