Finding system information from the command line
Other System Hardware Information
Outside of hard drives and processor chips, the basic command for hardware devices is lspci. As you might guess from the name, the command lists the PCI buses that are installed on the system. If you want to know what wireless card your laptop is using, so you can find a driver, or which video card you have, so you can look up information about it, then lspci is the command for you.
The first thing you need to know is that lspci displays information at three levels of detail – or verbosity. To get the least detail, enter only lspci (Figure 9). To get the next level of detail, type lspci -v, and for the most detail, use lspci -vv.
The next thing you need to know is that, even at the lowest level of detail, lspci produces more information than even a full-screen virtual terminal can display all at once. Therefore, you will want to pipe the command through less or more so that you can scroll up and down as needed: lspci | less or lspci | more. If you know information about the device you are looking for, such as its bus or slot, you can filter lspci's output, but in many cases, that is exactly the information you are trying to find, so this filtering is usually of limited use.
The lspci command also comes with a number of useful switches that provide even more information. For instance, -nn shows the numerical and English names of each device, whereas -k shows the kernel modules associated with the device. No matter what options you use, lspci gives so much information that only stone cold hardware gurus will understand it all, but if you use the right switches and take your time, you can usually find the information that you need.
An Alternative
These commands are not the only ones that give you information about your system – they're just the most basic. Other commands give at least part of the same information as those listed here; for example, you could use dnsdomainname to find the machine name instead of uname. However, the commands here are the most multipurpose and should give you most of the information you likely want or need.
However, one alternative is comprehensive enough to be worth mentioning. If you need information that these commands don't provide, or if you are curious about an alternative, you can also try looking at /proc, which is the pseudo-filesystem generated during bootup that contains information from the kernel. Ordinarily, the /proc directory is something that you should never meddle with, especially when logged in as root, because one wrong move could bring your system down. However, as long as you confine yourself to basic viewing commands like cat or more, you cannot damage it.
If you change to /proc and enter the ls command, you will find that the directory comprises a number of folders and files. If you view the files, you will see a variety of information about your system and how it operates. For instance, cat ./version gives information about the version of the kernel and the distribution you are using, whereas cat ./cpuinfo gives detailed information about the chipset in your system. Even if you can't guess what sort of information each file contains by its name, viewing is still harmless.
The advantage of reading from /proc is that you have fewer commands to remember. The disadvantage is that the information is not organized systematically from the human perspective.
However, between the traditional commands and /proc, you should find all the information you will ever need about your software and hardware and – as often as not – much more. Both are ways of using the command line to obtain information that is simply unavailable from the desktop.
« Previous 1 2
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.
-
System76 Unveils an Ampere-Powered Thelio Desktop
If you're looking for a new desktop system for developing autonomous driving and software-defined vehicle solutions. System76 has you covered.
-
VirtualBox 7.1.4 Includes Initial Support for Linux kernel 6.12
The latest version of VirtualBox has arrived and it not only adds initial support for kernel 6.12 but another feature that will make using the virtual machine tool much easier.
-
New Slimbook EVO with Raw AMD Ryzen Power
If you're looking for serious power in a 14" ultrabook that is powered by Linux, Slimbook has just the thing for you.
-
The Gnome Foundation Struggling to Stay Afloat
The foundation behind the Gnome desktop environment is having to go through some serious belt-tightening due to continued financial problems.
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.