5 Linux commands you need to gather the most important system information
When I was using Linux, I knew that all the information I needed was just a few commands away. If you want to know that, Linux has you covered — from security, networking, disk space, users, and everything in between.
Also: The first 5 Linux commands that new users should learn
But what about your hardware? How do you collect information about the actual machine you are using? This can be useful when you need to know which CPU you’re dealing with, which drive is connected, or the company that manufactured the machine (and even the version number). Luckily, those details are at your fingertips, and I’ll show you five commands to help you glean it. So stretch those fingers out and get ready to type.
1. unnamed
I often need to know the kernel version running on my machine. Maybe I want to check if this is the latest version. Or maybe VirtualBox is having problems and I need to know which kernel is currently loaded. Although this is not a hardware issue, it is certainly a very important one. For example, you may hear about a vulnerability that has been discovered in a particular kernel, and you want to know whether that vulnerability affects your system. If so, you obviously want to upgrade immediately.
To find out which kernel is running on your Linux computer, you will use the command no name command with -r option (for nuclear release). That command is:
It will print out something like this:
6.8.0-76060800daily20240311-generic
I’m running kernel 6.8.0 on Pop!_OS.
2. lscpu
Do you need to know details about the CPU on your machine? If so, then lscpu The command has you covered. This awesome tool lists information like architecture, number of cores, vendor ID, model name, CPU family, threads per core, cores per socket, sockets, min/max CPU MHz , flags, caching, vulnerabilities, etc
To find out details about your CPU, issue the command:
That’s it. Make sure to check the Vulnerabilities section as it will list whether mitigations have been applied to issues like Specter V1 and V2.
3. lsblk
This is the command I need to execute when I need to know where the drive is mounted. When you have multiple drives on a system, it can be a bit confusing as to which drive is mounted in which folder. Fortunately, lsblk simplify it. When you run this command, you’ll see the drive name (such as sda1) and the location it’s mounted in, such as /media/jack/music. This command will also tell you the size of the disk (this is also useful when you know the size of the disk but don’t know its name).
Also: 5 Linux commands you need to know to troubleshoot problems
To view this information, simply issue the command:
You can also view information for a specific drive, as follows:
4. dmide code
This is the king of system information gathering commands. The dmidecode command is a tool to convert DMI table contents into readable form. This not only describes the make-up of the system, but also describes things like the fastest CPU supported or maximum memory supported.
You can run sudo dmide code just a command that prints a long list of information (most of which you probably won’t need). You can also limit it to system information only with the command:
You will probably find much of the information from the above command similar to the information from the command lscpu request. That’s good because if you run sudo dmide code command without options, you will get more detailed information.
5. lsusb
Many times over the years I have encountered USB problems. Either that or I have so many USB peripherals connected to one machine that I’m not sure what it is. Other times I need to know the official name of the device that is plugged in (because often the make/model of the device is not the same as what the USB system detects). In that case, there is one command I turn to and that is lsusb. Run that command without any arguments and it will display a list of every USB device attached to your computer. I can’t tell you how many times this command has helped me fix USB connection problems.
You can also view the information as a tree (including port numbers) with the command:
And those are the five commands I always use when I need to gather information about a system. Whether you’re troubleshooting or just need detailed information about your computer, these tools are a great place to start.
And remember, to learn more about each command, read its man page (such as man uname, man lscpu, man lsblk, man dmidecde, And man lsusb).