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
-
The GNU Project Celebrates Its 40th Birthday
September 27 marks the 40th anniversary of the GNU Project, and it was celebrated with a hacker meeting in Biel/Bienne, Switzerland.
-
Linux Kernel Reducing Long-Term Support
LTS support for the Linux kernel is about to undergo some serious changes that will have a considerable impact on the future.
-
Fedora 39 Beta Now Available for Testing
For fans and users of Fedora Linux, the first beta of release 39 is now available, which is a minor upgrade but does include GNOME 45.
-
Fedora Linux 40 to Drop X11 for KDE Plasma
When Fedora 40 arrives in 2024, there will be a few big changes coming, especially for the KDE Plasma option.
-
Real-Time Ubuntu Available in AWS Marketplace
Anyone looking for a Linux distribution for real-time processing could do a whole lot worse than Real-Time Ubuntu.
-
KSMBD Finally Reaches a Stable State
For those who've been looking forward to the first release of KSMBD, after two years it's no longer considered experimental.
-
Nitrux 3.0.0 Has Been Released
The latest version of Nitrux brings plenty of innovation and fresh apps to the table.
-
Linux From Scratch 12.0 Now Available
If you're looking to roll your own Linux distribution, the latest version of Linux From Scratch is now available with plenty of updates.
-
Linux Kernel 6.5 Has Been Released
The newest Linux kernel, version 6.5, now includes initial support for two very exciting features.
-
UbuntuDDE 23.04 Now Available
A new version of the UbuntuDDE remix has finally arrived with all the updates from the Deepin desktop and everything that comes with the Ubuntu 23.04 base.