- How to Display Linux Hardware Info via Command Line
- 1. lshw
- 2. Inxi
- 3. hwinfo
- 4. lscpu
- 5. lsscsi
- 6. lsblk
- 7. lsusb
- 8. lspci
- 9. Using dmesg
- 10. Using dmidecode command
- 11. hdparm
- 12. From /proc file
- 13. free
- Conclusion
- How to Use Linux to Find the Names of the Devices on Your Computer
- Try these commands to show devices on your computer
- Use the ‘mount’ Command
- Use ‘lsblk’ to List Block Devices
- How to List PCI Devices
- List the USB Devices Attached to the Computer
- Summary
- List USB Devices Linux
- Listing USB Devices using lsusb Command
- Listing USB devices with usb-devices Command
- Listing Block USB Devices
How to Display Linux Hardware Info via Command Line
When a user works on a Linux system, in some cases, the user needs to know the information about the hardware under the operating system. This helps us to install compatible applications and utilities which adapt to hardware components of the system.
This tutorial will go through many utilities with detailed explanations of how to get the Linux hardware information.
1. lshw
The lshw stands for List Hardware. It collects the detailed information of the hardware on your system. lshw can show you the name of mainboard, CPU information, bus speed and firmware version and more.
In order to display the information of all the hardware components, run:
If you want to shorten the result, run the command with -short option:
You will receive the brief list of hardware components on your Linux system:
Display disk properties and storage device properties on Linux system by running:
You can get the brief result you may use the option -short :
This tool is also available in a GTK graphical version:
2. Inxi
Inxi is a powerful feature-rich command line tool for Linux users when they want to get the information of system hardware, CPU, RAM, Graphics card, drivers, battery, kernel, process information, and more.
By default, Inxi is not pre-installed on Linux. In order to use it, install the inxi package by running the following command:
Running inxi without any option:
The command will return the information of CPU and Memory as follows:
In order to get the graphics info, run the following command:
To show audio/sound card information, run:
To show battery data, charge, condition, plus extra information (if battery present), run the command with -B option:
3. hwinfo
The hwinfo command is a powerful tool for Linux users to get the detail of hardware components of system. It helps you collect almost of information about: CPU, USB controller, graphics controller, network devices and more.
You can use hwinfo command with —short and —devicetype options to list a specific type of information.
Display information about NIC cards and find out what eth0, eth1 stands for by running:
In order to display storage information with hwinfo command, run:
Likewise, to display list of partitions and hard disks, run the following command:
4. lscpu
The lscpu will show you all the information of your CPU such as number of CPUs, cores, threads, sockets and CPU family, caches, model and more.
You can get the detail of the CPU by running the following command:
The output of the command will be something likes this:
Moreover, if you want to view the speed of the CPU in MHz, run the command:
5. lsscsi
The lsscsi is used to list all of the SCSI (Small Computer System Interface) devices and NVMe (Non-Volatile Memory express) devices on your machine.
By default, the lsscsi is not pre-installed on Ubuntu, run the following command to install:
You can simply use the command by running:
6. lsblk
The lsblk command will show you the details of all the block devices in a tree format. It gathers information from sysfs filesystem and udev database.
In order to list all of block devices and their partitions and sizes, let’s run the following command:
7. lsusb
The lsusb is a powerful tool for displaying all the information about USB devices connected to USB buses of your Linux system. The information contains: speed, class, vendor id, product id, bus of USB devices etc.
You can run the following command to get brief information:
If you want to display the specified device with Bus and Device number, run the command with ‘-s’ option. For example:
8. lspci
This standard Linux utility shows what your systems have got internally. The command is a combination of ls, the standard command to list files and PCI that is for the peripheral connection. You can also expect your results to include AGP and onboard components like your USB chipset.
The command is much helpful in diagnosing bugs related to PCI devices. Using ‘-t’ option of lspci command you can see PCI layout in a tree format.
In order to get more detailed information, use -v option with -t option:
You can just run lspci command to display basic device information:
9. Using dmesg
The dmesg command is useful to find out some info about hardware events. It displays the contents of the system log.
The following command lists all references to universal serial bus devices:
In order to display the details about physical memory that is RAM, run:
10. Using dmidecode command
Dmidecode stands for Desktop Management Interface decode, it is a powerful tool for retrieving the information of CPU, RAM, serial numbers, BIOS. The command will show you the hardware details in a human-readable format.
In order to get the Information about BIOS, run:
If you want to display the hardware components information by ID, run the command with -t option following by a number ID (DMI).
For example, the following command will show you the information of memory Device:
11. hdparm
The hdparm stands for Hard Disk Parameter. It’s a Linux command line utility used for handling hard disk devices. You can also use hdparm command to set parameters such as power management, sleep mode, drive caches, Direct Memory Access settings, etc.
For instance, in order to display information of the hard disk, run the following command:
Another example, you can use hdparm to test the speed of hard disk by running the following command:
12. From /proc file
The /proc directory contains lots of system and hardware information. You can try the following commands to get more info on devices:
The output of the command will be something likes this:
In addition, you can run some other commands in order to get information about CPU, Memory, and PCI devices respectively.
13. free
Sometimes, you want to know whether the free memory (RAM) is enough to launch or install a new program? In this case, you can use free command to get information about memory detail in your Linux system.
The free command not only shows you information about the total amount of physical RAM and swap but also free and used memory. For example:
Conclusion
In this tutorial, we learned how to use Linux command line to get information about the hardware components of the system.
Thanks for reading and please leave your suggestion in the below comment section.
Источник
How to Use Linux to Find the Names of the Devices on Your Computer
Try these commands to show devices on your computer
Listing the devices, drives, PCI devices, and USB devices on your computer involves a series of commands easily invoked from a shell prompt in Linux.
Use the ‘mount’ Command
The most simple syntax you can use is as follows:
The output from the above command is fairly verbose and will be something like this:
Hard drives generally start with /dev/sda or /dev/sdb, so use the grep command to reduce the output as follows:
The results show something like this:
This doesn’t list your drives but it does list your mounted partitions. It doesn’t list partitions that aren’t yet mounted.
The device /dev/sda usually stands for the first hard drive on your system, and if you have a second hard drive, then it will be mounted to /dev/sdb. If you have an SSD, then this will likely be mapped to /dev/sda and the hard drive mapped to /dev/sdb.
Use ‘lsblk’ to List Block Devices
Mount is fine for listing mounted devices, but it doesn’t show every device you have, and the output is verbose, making it difficult to read.
The best way to list the drives in Linux is to use lsblk as follows:
The information displays in a tree format with the following information:
- Name
- Major Minor device number
- Is it removable
- Size
- Is it read-only
- Is it a disk or a partition
- Where is the partition mounted
The display looks something like this:
The information is easier to read. It displays one drive called sda, which offers 50 G of storage. It splits into one partition, called sda1.
The drives fd0 (floppy) and sr0 (CD-ROM) appear in this listing. The particular machine this listing drew from, called mint-vm, is a Linux Mint virtual machine running in the Hyper-V system on a Windows 10 computer. Hyper-V provisions a virtual floppy and CD-ROM drive by default.
How to List PCI Devices
To list the PCI devices use the lspci command as follows:
The output from the above command is verbose, meaning you probably get more information than you need.
Here’s a short snapshot as an example:
The listing lists devices, including VGA controllers, USB controllers, sound, Bluetooth, wireless, and Ethernet controllers.
The standard lspci listing is considered basic, and if you want more detailed information about each device, run the following command:
The information for each device looks something like this:
The output from the lspci -v command is more readable.
You can get even more verbose output by using the following command:
If that isn’t enough information, try the following:
The most useful aspect of lspci, other than listing devices, is the kernel driver used for that device. If the device isn’t working, it is worth researching whether there is a better driver available for the device.
List the USB Devices Attached to the Computer
To list the USB devices available for your computer, use the following command:
The output will be something like this:
If you insert a USB device into the computer, such as an external hard drive, and then run the lsusb command, the device appears on the list.
Summary
The best way to list anything in Linux is to remember the following ls commands:
Источник
List USB Devices Linux
In the world of USB computer peripherals, almost everyone uses some sort of USB devices in their computer. These days there are USB webcams, USB hard drives, USB stick also known as PenDrive etc. Almost every device has a USB version of it. So if you’re using Linux, listing what USB device is connected to your system might be necessary at some point.
There are many programs and many ways to list USB devices on Linux.
In this article, I will show you how to list USB devices on Linux. I am using Ubuntu 18.04 Bionic Beaver for the demonstration, but these commands are available on every Linux distribution. So let’s get started.
Listing USB Devices using lsusb Command
The widely used lsusb command can be used to list all the connected USB devices in Linux.
As you can see from the output of the lsusb command in the screenshot below, all the connected USB device is listed. The Bus ID, Device ID, USB ID, and a title is displayed in the output of lsusb command.
As you can see in the marked section of the screenshot below, Realtek Semiconductor Corp. with ID 0bda:57cb, this is my USB Webcam.
You can’t tell that it’s a Webcam by looking at the output of lsusb command, Can you? Nope! So how do I know this? It’s because I checked the output of the lsusb command before and after connecting the USB Webcam and once I compared the outputs, the newly added row is the USB device I connected. Plain! But there are ways to find out what the USB device is.
You can use the dmesg command to find out more information about the connected USB devices. The last connected USB device is the easiest to find with dmesg command. It is more widely used for debugging purpose. You will shortly see why.
You run dmesg command as follows:
As you can see in the yellow marked box in the screenshot below, these are information about the USB device I connected last, which was my USB Webcam. You can see in one of the blue marked box, the USB device I connected is a HD UVC WebCam and its ID is 0bda:57cb.
By now you may have found out that the output of dmesg command is system log messages. Well yes, it is.
You can also search for a specific USB device by its ID in the dmesg system log.
Run the following command to open the output of dmesg command with less text pager:
You should see the following window:
Now to search for a string, press / key on your keyboard. And you should the a / appear on the bottom of terminal window as marked in the screenshot below.
Now type in the USB device ID. For example, earlier when I listed the connected USB devices with lsusb command, one of the USB device had ID 0bda:57cb
Type in the USB Device ID and press . As you can see in the marked section of the screenshot below, the search string is marked white.
You may press and arrow keys to navigate up and down and read through it. You should find a lot of information about that USB device as you can see in the marked section of the screenshot below.
Listing USB devices with usb-devices Command
You can run the following command to list all the connected USB devices of your system:
As you can see in the screenshot below, all the connected USB devices are listed. we can find out pretty much the same information as before with usb-devices command.
Listing Block USB Devices
If you want to list all the USB block storage devices, that is all the USB storage devices, then you can use the lsblk or fdisk command to do so.
Listing USB block storage devices with lsblk:
As you can see in the screenshot below, all the available block storage devices (including the USB block storage devices) are listed.
You can get almost the same information as lsblk command with blkid command. But you have to run it as root as follows:
You can also use fdisk command to list all the USB block storage devices as follows:
As you can see in the screenshot below, the connected block storage devices (including the USB devices) are listed.
That’s how you list all the USB devices on Linux. Thanks for reading this article.
Источник