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.

Read full article as PDF:

Related content

comments powered by Disqus

Direct Download

Read full article as PDF:

News