Cadastre-se agora para um orçamento mais personalizado!

5 Linux commands you need to gather your system's most important information

Jun, 17, 2024 Hi-network.com
lsubcommand
Jack Wallen/

When I'm using Linux,I know that all the information I need is only a few commands away. If you want to know it, Linux can give it to you -- from security, network, disk space, users, and everything in between.

Also: The first 5 Linux commands every new user should learn

But what about your hardware? How do you gather information about the actual machine you are using? This can come in handy when you need to know what CPU you're dealing with, what drives are connected, or what company made the machine (and even the version number). Fortunately, those details are at your fingertips and I'm going to show you five commands to help you gather it. So, stretch out those fingers and get ready to type.

1. uname

I often need to know the version of the kernel that is running on my machine. Maybe I want to check and see if it's the latest version. Or maybe VirtualBox is having problems and I need to know which kernel is currently loaded. Although this isn't a hardware issue, it is certainly a very important one. For example, you might hear about a vulnerability that has been discovered in a particular kernel and you want to know if that affects your system. If so, you'd obviously want to upgrade immediately.

To find out what kernel is running on your Linux computer, you'll use theunamecommand with the -r option (forkernel release). That command is:

uname -r

It should print out something like this:

6.8.0-76060800daily20240311-generic

I'm running kernel 6.8.0 on Pop!_OS.

2. lscpu

Need to know the details about the CPU on your machine? If so, thelscpucommand has you covered. This gem of a tool lists out information like architecture, number of cores, vendor ID, model name, CPU family, threads per core, cores per socket, sockets, stepping CPU min/max MHz, flags, caches, vulnerabilities, and more.

To find out the details of your CPU, issue the command:

lscpu

That's it. Make sure to check the Vulnerabilities section because it will list if mitigations have been applied to issues like Spectre V1 and V2.

3. lsblk

This is my go-to command when I need to know where a drive is mounted. When you have multiple drives on a single system, it can get a bit confusing as to which is mounted to what directory. Fortunately,lsblksimplifies that. When you run this command, you'll see the disk name (such as sda1) and where it's mounted, such as /media/jack/music. The command will also inform you how big a disk is (which is also helpful when you know the size of a disk but not the name of the disk).

Also: 5 Linux commands you need to know to troubleshoot problems

To view this information, simply issue the command:

lsblk

You could also view the information of a specific drive, like so:

lsblk /dev/sda1

4. dmidecode

This is the king of commands for gathering system information. The dmidecode command is a tool for dumping the DMI table contents into a human-readable form. This not only describes what the system is made of but also things like the fastest CPU supported or max memory supported.

You can run thesudo dmidecodecommand alone, which prints out a lengthy list of information (most of which you probably won't need). You can also limit that to only system information with the command:

sudo dmidecode -t system

You'll probably find much of the information from the above command is similar to that from thelscpucommand. That's fine because if you run thesudo dmidecodecommand with no options, you'll receive considerably more details.

5. lsusb

I have, on several occasions over the years, found myself with USB issues. Either that or I've had so many USB peripherals connected to a machine that I wasn't quite certain what was what. At other times, I needed to know the official name of a device that was plugged in (because often the make/model of a device isn't the same as what the USB system detects). When that's the case, there's one command I turn to and that'slsusb. Run that command without any arguments and it will display a listing of every USB device attached to your computer. I cannot tell you how many times this command has helped me troubleshoot a USB connection. 

You can also view the information as a tree (which includes the port number), with the command:

lsusb -t

And those are the five commands I always turn to when I need to gather information about a system. Whether you're troubleshooting or just needing details for a computer, these tools are a great place to start. 

And remember, to find out more about each command, read its man page (such asman uname, man lscpu, man lsblk, man dmidecde,andman lsusb).

tag-icon Tags quentes : Tecnologia

Copyright © 2014-2024 Hi-Network.com | HAILIAN TECHNOLOGY CO., LIMITED | All Rights Reserved.