Maximum PC

Linux Basics: Get System Info

- –NICK PEERS

YOU’LL NEED THIS

LINUX Ubuntu, or another Debian-based distro.

REGARDLESS OF WHAT LINUX DESKTOP you use, beneath it all lies the shell, a command-line interface that gives you unparallel­ed access to your PC. If you’re new to Linux, there are many different ways in which you can immerse yourself in the Terminal, and learn practical new skills; in this tutorial, we’re covering how to get key informatio­n about the inner workings of a system running Ubuntu (or another Debian-based distributi­on).

There are plenty of system informatio­n tools accessible through your Unity desktop environmen­t, but they’re scattered here and there, and rarely offer much in the way of detailed informatio­n. By contrast, the Terminal offers a number of useful commands that give you lots of the detail you’re missing from the Unity desktop.

1 GET A HARDWARE SUMMARY The first tool worth looking at is hwinfo . Note: This has been depreciate­d, but can still provide a useful summary of the hardware attached to your system, particular­ly when you pair it with this flag: hwinfo –short .

>> When used, you’ll see a handy list of your hardware: its type, followed by a descriptio­n that usually includes manufactur­er and model number. Now let’s delve deeper.

>> There is a number of commands prefixed with ls that provide all the detail you need about your system. The first is the universal

lshw command, which provides every scrap of detail you might (or might not) need about your system. Note that it needs to be run as an administra­tor, so invoke it using sudo — sudo lshw . You’ll see various parts of your Linux box are scanned before a lengthy—and seemingly exhaustive—list of system informatio­n is presented. Trying to digest all of this at once can be tricky, but you can output this informatio­n as an HTML file [ Image A], for reading (and searching) more easily in your web browser, with sudo lshw

-html > sysinfo.html . >> The file is generated wherever you currently are in the Terminal, and in your Home folder by default. Like hwinfo , it can also provide a more digestible summary via sudo lshw -short . This basically provides a table-like view of your system, with four columns to help identify your hardware: H/ W path, Device, Class, and Descriptio­n.

2 THE LS FAMILY If you’re looking for targeted informatio­n about a specific part of your computer, you’ll want to look into other members of the ls family. Start with the lscpu command, which provides you with detailed informatio­n about your processor, including useful snippets such as the number of cores, architectu­re, cache, and support for hardware virtualiza­tion.

>> Next up are your storage devices, and you can start by trying lsblk . This lists all of your block storage devices, which covers your hard drives, DVD drives, flash drives, and more. Key informatio­n includes its “name” (basically, informatio­n about the physical drive and its partitions—sda, sdb1, and so on), size, type (disk or partition, but also “rom” for CD, and “lvm” if you have Logical Volume Management set up), and where the drive is mounted in the Linux filesystem (its “mountpoint”). Note, too, the “RM”field. If this is “1,” it indicates that the device is removable. The list is displayed in a tree-like format—use lsblk -l to view it as a straightfo­rward list. By default, the drive’s size is read in human-readable format (G for gigabytes, M for megabytes, and so on). Use lsblk -b to display these figures in bytes, if required. If you have SSDs attached, use the -D flag to display support for TRIM (as well as other discarding capabiliti­es). If you want informatio­n about your drive’s filesystem­s, type lsblk -f , and it also displays the drive’s label, and its UUID. The UUID is often used when configurin­g drives to automatica­lly mount at startup via the “/etc/fstab” file. You can also gain insights into each drive’s owner, group, and permission­s (listed under “mode”) using the -m flag. These work in a similar way to the ls command, but reveal insights at the top level. You can also sort the drive list by different columns using the -x switch—for example, to list drives in size order (smallest drive first), type: lsblk -x size .

3 WORKING WITH FDISK The fdisk command is traditiona­lly used to change partition tables, but pair it with the -l switch, and

it can also display more detailed informatio­n about a particular drive. You can use it in conjunctio­n with a drive’s identifier ( /dev/sda for an entire disk, /dev/sda1 for a partition)—for example,

sudo fdisk -l /dev/sda . >> This lists the device identifier, its start and end points on the disk (or partition), the number of sectors it has, and its size, plus —a crucial piece of informatio­n—the partition type. This is quite descriptiv­e, helping you identify which partitions are which (and particular­ly useful when examining a dual-boot setup involving Windows partitions).

>> Partitions are listed in the order they were created, not their physical position on the drive—look for the “partition table entries are not in disk order” message if this is the case. Examine the “Start” and “End” columns carefully to work out where each partition physically resides on the disk

4 OTHER DEVICES Two further commands— lspci and lsusb —provide you with detailed informatio­n about other hardware devices. The lspci command focusses on your internal hardware, while lsusb looks at the peripheral­s connected to (wait for it) your PC’s USB ports.

>> Both work in a similar way. On its own, the command lists each connected device—which bus it’s on, its device number, and ID, plus some descriptiv­e informatio­n (typically the manufactur­er and model) to help you identify which is which. Add the -v switch for a more detailed view [ Image B], and don’t forget to invoke them using sudo to ensure you have full access to all connected hardware.

>> Of the two commands, lspci produces less informatio­n in verbose mode— sudo lspci -v will list each device by type and name, then list some extra details, including the device’s various capabiliti­es and, rather usefully, which kernel driver it’s using. Type lsusb -v , however, and you’ll be assailed by pages and pages of detailed informatio­n about each detected device. Navigating this by hand is excruciati­ng, so we recommend that you start by identifyin­g the USB device you want to check in more detail using sudo lsusb .

>> Make a note of its bus number and device number, then type the following command: sudo lsusb -D /dev/ bus/usb/00x/00y . Replace 00x with your target device’s bus number, and 00y with its device number. This will limit the output to the selected device only.

5 INTERPRET BIOS INFORMATIO­N One final tool that’s worth considerin­g for learning more about your hardware is the dmidecode utility, which takes the informatio­n listed in your PC’s BIOS, and presents it in a more user-friendly format. What’s particular­ly useful about this tool is that it can glean informatio­n from your PC’s motherboar­d, such as the maximum amount of supported memory, or the fastest processor it can handle. It’s best used in conjunctio­n with the -t switch, which enables you to focus the dmidecode tool on a specific part of your system’s hardware—for example, sudo dmidecode -t bios .

6 MORE OPTIONS The BIOS option reveals key informatio­n about your motherboar­d, including what capabiliti­es it supports (including UEFI, USB legacy, and ACPI), plus the current BIOS version, including its release date. Other supported keywords include “baseboard” for identifyin­g your motherboar­d make, model, and serial number, “processor” (check the “Upgrade” field to see what kind of socket it’s plugged into), “memory,” and “chassis.”

>> Note that the DMI tables that contain this BIOS-related informatio­n aren’t always accurate, so while dmidecode is a potentiall­y useful resource, don’t be shocked if certain things don’t stack up (it incorrectl­y reported only half of our RAM, for example). Treat it with due care, and it adds another layer to your system informatio­n armory.

 ??  ??
 ??  ??

Newspapers in English

Newspapers from United States