Obtain information about internal hardware on GNU Linux’s console or terminal

There are users who read this article, they will think, but if I can know through the graphical interface with X or Y software to see the information connected to my PC, well the answer is the following; If your computer has an operating system installation without a graphical interface and the only interface to access it is through the command terminal, or, if it is a server that does not have a graphical interface, how can you consult the information about the hardware connected to the computer/server.

It should be noted that the commands to use to view this information are usually available in all GNU/Linux distributions in their base installation, this means that this article to be a simple and direct reference applicable to practically all GNU/Linux distributions under the POSIX standard, many of these commands may also be available on operating systems such as FreeBSD, Hurd, among others.

Most of these commands, as they are informative, do not require or access GNU / Linux operating system files that contain this information, it is not necessary to be an administrator (root) of the operating system, this makes it easier for us to consult the information of the connected hardware if not you have access as administrator (root) of the operating system.

To start we can execute the following command which is:

cat /proc/meminfo

This “cat” command allows you to print the content of plain text files on the screen. It is one of its basic functions, although it can be used for even more advanced functions.

The output from running the command would look something like this:

MemTotal: 3942912 kB
MemFree: 146 732 kB
MemAvailable: 1292696 kB
Buffers: 112208 kB
Cached: 1543336 kB
...

As can be seen, the printing of the result in the console of the execution of the command is shown in a summarized way, which shows detailed information about the RAM memory installed in the computer/server.

In the following information to consult, any of these 2 commands can be executed:

lscpu
cat /proc/cpuinfo

The output of this command in summary form is as follows:

processor : 0
vendor_id : GenuineIntel
cpu family : 6
Model : 76
model name : Intel (R) Celeron (R) CPU N3160 @ 1.60GHz
staggering : 4
microcode : 0x411
CPU MHz : 992,664
Cache size : 1024 KB

...

The output has been summarized so as not to show it completely, but as you can see, it shows detailed information about the CPU connected to the motherboard of the computer / server.

Then the following command:

lspci

Which output is the following:

00: 00.0 Host bridge: Intel Corporation Atom / Celeron / Pentium Processor x5-E8000 / J3x
xx / N3xxx Series SoC Transaction Register (rev 35)
00: 02.0 VGA compatible controller: Intel Corporation Atom / Celeron / Pentium Processor x5-E8000 / J3xxx / N3xxx Integrated Graphics Controller (rev 35)
00: 10.0 SD Host controller: Intel Corporation Atom / Celeron / Pentium Processor x5-E8

...

This is a summary output of the command this shows all the internal hardware connected in an integrated way to the motherboard or by expansion slots.

dmidecode -t baseboard

This command shows detailed information about the motherboard of the computer / server but unfortunately it needs administrator (root) permissions.

Below the following command you can see the information of the storage units and their partitions connected to the computer / server.

lsblk -fm

Here is an image that shows its output on the terminal or console screen:

The following shows all the hardware connected via usb to the computer or server:

lsusb

Its output is summarized below as an example:

Bus 002 Device 001: ID 1d6b: 0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0bda: b720 Realtek Semiconductor Corp.
Bus 001 Device 004: ID 10c4: 8108 Cygnal Integrated Products, Inc.
Bus 001 Device 008: ID 0e8d: 201c MediaTek Inc.
Bus 001 Device 001: ID 1d6b: 0002 Linux Foundation 2.0 root hub

All these commands are very useful to know the information of the connected hardware but we must also always know which version of the GNU / Linux distribution we have installed on the computer or server, in case of not knowing it, we can observe it in the terminal or console by executing these two commands:

uname -a

cat /etc/issue.net

In this way we can be aware of the available hardware, but the question is there a way to simplify this process? The answer to it is yes, installing the program called hwinfo which is not always installed by default in GNU / Linux distributions and which we can install with the command:

apt-get install hwinfo

or

yum install hwinfo

Then it will only be necessary to execute the command:

hwinfo

But it shows too much information and it is recommended to use the following combined command to be able to see this information:

hwinfo> /tmp/info && nano /tmp/info

Although if you want to obtain more precise information, you only have to consult the options to see the specific information or the one we are looking for, we only have to learn a little about the hwinfo program by executing some of these 2 commands:

man hwinfo

hwinfo –help

As you could see, it is quite easy to check the information of the hardware connected on a computer/server that has GNU/Linux installed as the default operating system.

All aspiring sysadmin or technical support in GNU/Linux must be aware of their use since many times they do not have physical access to the internal and working hardware in the computer / server.

It should be noted that there are already graphical tools that show this information well formatted and very understandable and in a very simple way for end users in operating systems based on Linux distributions, but it does not hurt to know more direct and advanced ways to be able to consult this information.

Possibly there are commands or more files that contain information about the connected hardware, software elements, other devices that are not shown in the explanation made here, these are hardware devices, generally RS232 connection or other types of connection, in those cases it is good to investigate a little. On the internet in this regard, although for this it is enough to search in the following directories of the operating system /dev and /proc there we could find the information that we are looking for the connected hardware or the file that identifies the connected hardware.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.