One of the sections that makes it more difficult for novice users of Linux in general and Ubuntu in particular, is the device recognition in the system when they have not been detected automatically. As you know, the detection of computer hardware, unlike what happens in Windows systems, is performed by the kernel at the time of system boot, there is also the possibility of later recognizing other devices that connect hot.
This little guide aims to illustrate a bit on common tasks for recognizing hardware in Ubuntu, where we will talk about the most common elements: CPU, memory and storage among others.
Often the problem it is not about how to look but what, Since the drivers of the hardware elements of a computer in Unix systems vary slightly to how it is done in Windows environments (the kernel of Windows is supported mainly in the drivers to support different system components while in Linux it is the kernel that supports most devices).
Without being able to come up with all sorts of devices and hardware components that can exist on a computer (since that would be an unattainable task), we want to collect those main that every computer can have and that they are not automatically detected by the system. These steps can be considered essential in many cases to then be able to find the necessary drivers and add them to the system.
General listing of a computer’s hardware
In general, we can use the following order get a general summary of all detected hardware in our team.
$ sudo lshw
As you will see the list is generates is very extensive and detailed, so it is convenient to pour into a file or bind a more function to read it more calmly.
Recognizing the processor
The processor is one of the fundamental components of a computer, along with memory and input and output devices. A system file and a simple command can help identify what type of processor is being recognized in our environment. This component is supported inside the kernel, so if there is a problem with not recognizing all the capabilities of our processor, we would need a kernel (or distribution) to support it.
The file located inside / Proc / cpuinfo will give us detailed information of the recognition of our CPU:
And through the order lscpu, Which does not require any more modifiers, we can get CPU data in a friendly way:
Memory is another of the key elements within the system. Good management of the same as the option to take advantage of all its capabilities ensure proper operation of the operating system and optimal performance. To obtain technical data from it we have to resort to the general command about system hardware that we tell you at the beginning, remember, lshw.
There is also another series of commands that allow us to obtain general information about the amount of memory and its dentin within the operating system, which can give us enough information to determine if the installed modules are being detected correctly. on the team or not. details of how it is being recognized within the operating environment. Take the top orders as an example (to determine the total amount and the amount that is swapped), vmstat -SM -a (For details on
Recognizing hard drives
The next order well known to all, fdisk, To us lists the storage devices detected on our computer.
$ sudo fdisk -l
But what if we just connected a new SATA or SCSI disk and it is not detected by the system? That’s one thing very common if you use SATA disks with hot connection (Verify that the hot swap in the computer’s BIOS or it will work as a current IDE disk and you will need to restart your computer for the system to detect it) or virtual machines, Where it is possible to add SCSI disks that are not automatically recognized by the computer.
If this is your case, you will have to force the controller to restart. To do this, enter the following command:
$ grep mpt /sys/class/scsi_host/host?/proc_name
This command will return you a line of type: / Sys / class / scsi_host /hostX/ Proc_name: mptspi (on hostX is the field we are interested in). Then enter the following command to force rescanning:
echo "- - -" > /sys/class/scsi_host/hostX/scan
Recognizing the graphics card
If you remember that we mentioned at the beginning of the article that the Linux kernel ceded the handling of certain devices to the installed drivers of the computer, the case of graphics cards is one of those devices the handling is inherited. That is why the command that will help us in this case is:
lspci | grep VGA
And it will give us driver information that the system is using on the computer.
With this information it is a matter of verifying whether we are using the correct driver within our system or whether we need to use another more specific or evolved one.
Recognizing USB devices
In this case we have a specific order for this type of device:
Its output will provide us with information about the connected USB devices as follows:
To restart USB devices, we can schedule a cronjob with the following command to update the status of the devices every minute:
* * * * * lsusb -v 2>&1 1>/dev/null
We hope you find this little guide useful for most of your system devices. Certainly there are many more commands in Linux and applications to download for more information.
Have you found any other commands useful in your work with the Ubuntu system to detect hardware?