Merge pull request #3722 from sonofelice/master

翻译完成
This commit is contained in:
Xingyu.Wang 2016-01-07 16:01:51 +08:00
commit 01e7cf3a8a
2 changed files with 149 additions and 151 deletions

View File

@ -1,151 +0,0 @@
sonofelice translating
How to Check Hardware Information on Linux Using Command Line
================================================================================
![](https://maketecheasier-holisticmedia.netdna-ssl.com/assets/uploads/2015/12/hdd_info_featured-1.png)
There are many commands available to check hardware information of your Linux system. Some commands report only specific hardware components like CPU or memory while the rest cover multiple hardware units.
This tutorial takes a quick look at some of the most commonly used commands to check information and configuration details about various hardware devices.
### lscpu ###
The `lscpu` command gives you information about the CPU and processing units. It does not have any other options or functionality.
lscpu
You will see the following output by running the above command.
![hdd_info_lscpu](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lscpu.png)
### lspci ###
The lspci is another command line tool that lists all the PCI buses and details about the devices connected to them like VGA adapter, graphics card, network adapter, usb ports, SATA controller, etc.
lspci
You will see an output similar to the following image.
![hdd_info_lspci](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lspci-1.png)
You can also filter out specific device information by running the following command:
lspci -v | grep "VGA" -A 12
You will see graphics card information similar to the following.
![hdd_info_lspci_vga](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lspci_vga.png)
### lshw ###
The `lshw` is a general purpose utility that reports detailed and brief information about multiple hardware units like CPU, memory, usb controller, disk, etc. Lshw extracts the information from different “/proc” files.
lshw -short
You will see the following information by running the above command.
![hdd_info_lshw](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lshw.png)
### lsscsi ###
You can list all scsi/sata devices like hard drives and optical drives by running the following command:
lsscsi
The output wIll look something like this image.
![hdd_info_lsscsi](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lsscsi-1.png)
### lsusb ###
This command shows you the USB controllers and details about devices connected to them. By default, the lsusb command prints brief information. You can also use the verbose option -v to print detailed information about each usb port.
lsusb
You will see the following output.
![hdd_info_lsusb](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lsusb.png)
### Inxi ###
`Inxi` is a bash script that fetches hardware information from multiple sources and commands on the system and gives you goodlooking reports that non-technical users can read easily.
By default, `inxi` is not installed in Ubuntu. You can install it by running the following command:
sudo apt-get install inxi
After installing inxi, you can get hardware information by running the following command:
inxi -Fx
You will see an output similar to the image below.
![hdd_info_inxi](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_inxi.jpg)
### df ###
This command gives you brief information about various partitions, their mount points and the used and available space on each.
You can run the `df` command with the `-H` parameter.
df -H
You will see the following output.
![hdd_info_df](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_df-1.png)
### Free ###
You can check the amount of used, free and total amount of RAM on your system with the free command.
free -m
You will see the following output.
![hdd_info_free](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_free.png)
### Dmidecode ###
The `dmidecode` command is different from all other commands. It extracts hardware information by reading data from the DMI tables.
To display information about the processor, run:
sudo dmidecode -t processor
![hdd_info_dmi_processor](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_dmi_processor.jpg)
To display information about the memory, run:
sudo dmidecode -t memory
![hdd_info_dmi_memory](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_dmi_memory.png)
To display information about the bios, run:
sudo dmidecode -t bios
![hdd_info_dmi_bios](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_dmi_bios.png)
### Hdparm ###
The hdparm command gives you information about sata devices like hard disks.
sudo hdparm
You will see the following output.
![hdd_info_hdparm](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_hdparm.png)
### Conclusion ###
Each of the commands has a different method of extracting hardware information. You can try more than one of them while looking for specific hardware details. All of the above tools are available in most Linux distros, and can be easily installed from the default repository.
--------------------------------------------------------------------------------
via: https://www.maketecheasier.com/check-hardware-information-linux/
作者:[Hitesh Jethva][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.maketecheasier.com/author/hiteshjethva/

View File

@ -0,0 +1,149 @@
Linux系统下使用命令行来查看硬件信息
================================================================================
![](https://maketecheasier-holisticmedia.netdna-ssl.com/assets/uploads/2015/12/hdd_info_featured-1.png)
有许多可用的命令可以用来查看Linux系统上的硬件信息。有些命令只能够打印出像CPU和内存这一特定的硬件组件信息其余的命令可以查看其余硬件单元的信息。
这个教程可以带大家快速学习一下查看各种硬件设备的信息和配置详情的最常用的命令。
### lscpu ###
`lscpu`命令能够查看CPU和处理单元的信息。该命令没有任何其他选项或者别的功能。
lscpu
运行该命令会看到下面输出:
![hdd_info_lscpu](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lscpu.png)
### lspci ###
`lspci`是另一个命令行工具可以用来列出所有的PCI总线还有与PCI总线相连的设备的详细信息比如VGA适配器、显卡、网络适配器、usb端口、SATA控制器等。
lspci
你可以看到类似下图的输出信息。
![hdd_info_lspci](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lspci-1.png)
可以通过运行下面的命令来过滤出特定设备的信息:
lspci -v | grep "VGA" -A 12
运行上面的命令可以看到类似下图的关于显卡的信息。
![hdd_info_lspci_vga](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lspci_vga.png)
### lshw ###
`lshw`是一个通用的工具可以列出多种硬件单元的详细或者概要的信息比如CPU、内存、usb控制器、硬盘等。`lshw`能够从不同的“/proc”文件中提取出相关的信息。
lshw -short
通过运行上面的命令可以看到下面的信息。
![hdd_info_lshw](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lshw.png)
### lsscsi ###
通过运行下面的命令可以列出像硬盘和光驱等scsi/sata设备的信息
lsscsi
会得到类似下面的输出。
![hdd_info_lsscsi](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lsscsi-1.png)
### lsusb ###
`lsusb`命令能够列出USB控制器和与USB控制相连的设备的详细信息。默认情况下`lsusb`命令只打印出概要信息。可以通过使用-v参数打印每一个usb端口的详细信息。
lsusb
可以看到下面输出。
![hdd_info_lsusb](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_lsusb.png)
### Inxi ###
`Inxi`是一个bash脚本能够从系统的多个源文件和命令行抓取硬件信息并打印出一个非技术人员也能看懂的友好的报告。
默认情况下Ubuntu上没有安装`inxi`。可以通过运行下面命令来安装`Inxi`
sudo apt-get install inxi
安装完`Inxi`之后,通过运行下面命令能够得到硬件相关的信息:
inxi -Fx
能够得到类似下图的输出。
![hdd_info_inxi](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_inxi.jpg)
### df ###
`df`命令能够列出不同分区的概要信息,挂载点,已用的和可用的空间。
可以在使用`df`命令的时候加上`-H`参数。
df -H
会得到下面的输出。
![hdd_info_df](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_df-1.png)
### Free ###
通过使用`free`命令可以查看系统中使用的、闲置的和总体的RAM数量。
free -m
会看到下面输出。
![hdd_info_free](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_free.png)
### Dmidecode ###
`dmidecode`命令与其他命令不同。该命令是从DMI表中读取硬件信息的。
要查看处理器的信息,运行下面命令:
sudo dmidecode -t processor
![hdd_info_dmi_processor](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_dmi_processor.jpg)
要查看内存的信息,运行下面命令:
sudo dmidecode -t memory
![hdd_info_dmi_memory](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_dmi_memory.png)
要查看bios的信息运行下面命令
sudo dmidecode -t bios
![hdd_info_dmi_bios](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_dmi_bios.png)
### Hdparm ###
`hdparm`命令可以用来显示想硬盘这样的sata设备的信息。
sudo hdparm
可以看到下面的输出。
![hdd_info_hdparm](https://www.maketecheasier.com/assets/uploads/2015/12/hdd_info_hdparm.png)
### 总结 ###
每个命令都有不同的方式来获取硬件的信息。在查看特定的硬件信息的时候可以尝试使用不同的方式。上面所有的命令行工具在大部分的Linux发型版本中都是可以使用的可以很容易的从仓库中获取安装。
--------------------------------------------------------------------------------
via: https://www.maketecheasier.com/check-hardware-information-linux/
作者:[Hitesh Jethva][a]
译者:[sonofelice](https://github.com/sonofelice)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.maketecheasier.com/author/hiteshjethva/