|
Checking Linux Hardware and Software Versions from the Command Line

Checking Linux Hardware and Software Versions from the Command Line

This article provides a comprehensive guide on how to use various command-line tools to check hardware and software versions of your Linux system. The content is divided into hardware and software sections, with detailed explanations for different types of hardware and software.

Software Version Check

1. Operating System Distribution Version

  • Using the /etc/os-release file: In modern Linux systems, the /etc/os-release file contains operating system identification data, including distribution version. You can use the cat command to view the file contents:
cat /etc/os-release

This command will output something similar to the following (using Debian as an example):

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

From this output, you can identify the version name (“buster”) and version ID (“10”).

  • Using the lsb_release command: The lsb_release command provides certain LSB (Linux Standard Base) and distribution-specific information. To check your Debian version, use this command with the -a option:
lsb_release -a

The output will be similar to:

No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster

The line labeled “Description” contains the information you’re interested in.

  • Other distribution-specific commands and files: Some distributions may have other commands or files that can provide version information. For example, Red Hat systems can use the cat /etc/redhat-release command.

2. Debian Version

In addition to the methods mentioned above, you can also check the Debian version by viewing the /etc/debian_version file. [The source doesn’t explicitly state this, but I added this information based on my knowledge of Debian systems, you may need to verify independently.]

3. Linux Kernel Version

To print the Linux kernel version, you can use the uname command with the -r option:

uname -r

This will output the currently running kernel version.

Hardware Information Check

1. CPU Information

  • lscpu: The lscpu command reports information about the CPU and processing units, without additional options or features.
lscpu
  • dmidecode -t processor: The dmidecode command extracts hardware information by reading data from the SMBIOS data structure (also known as the DMI table), the -t processor option can be used to display CPU information.
sudo dmidecode -t processor
  • /proc/cpuinfo: The /proc/cpuinfo file contains CPU-related information.
cat /proc/cpuinfo

2. Memory Information

  • dmidecode -t memory: Using the dmidecode command with the -t memory option can view memory information.
sudo dmidecode -t memory
  • hwinfo --short: The hwinfo command can report detailed hardware information, the --short option can display brief information, which includes memory information.
hwinfo --short
  • lspci: The lspci command lists all PCI buses and detailed information of devices connected to them, you can use this command to view graphics card information.
lspci

Using the -v parameter can get more detailed graphics card information:

lspci -v
  • lshw: The lshw command can report various hardware information, including display device information.
sudo lshw

4. Other Hardware Information

  • lshw: lshw is a general utility that can report detailed and brief information about various different hardware units.
sudo lshw
sudo lshw -short

You can also export lshw reports in HTML, XML, and JSON formats.

  • hwinfo: hwinfo is another general hardware probing utility that can report more hardware information than lshw.
hwinfo
hwinfo --short
  • inxi: inxi is a bash script that can obtain hardware details from multiple different sources and commands on the system, and generate a visually appealing report.
inxi -Fx
  • /proc files: Many virtual files in the /proc directory contain information about hardware and configuration.

SCSI/SATA devices: cat /proc/scsi/scsi

  • Partitions: cat /proc/partitions

  • lspci: The lspci command lists all PCI buses and detailed information of devices connected to them.

lspci
  • lsscsi: Lists SCSI/SATA devices, such as hard drives and optical drives.
lsscsi
  • lsusb: This command displays detailed information about USB controllers and devices connected to them.
lsusb
  • lsblk: The lsblk command gets detailed block device information, such as your hard drives, flash drives, and their partitions.
lsblk
  • df: Reports various partitions, their mount points, and used and available space on each partition.
df -H
  • fdisk: fdisk is a utility for modifying partitions on hard drives, and can also be used to list partition information.
sudo fdisk -l
  • mount: mount is used to mount/unmount and view mounted file systems.
mount | column -t
  • dmidecode: The dmidecode command extracts hardware information by reading data from the SMBIOS data structure (also known as the DMI table).

BIOS details: sudo dmidecode -t bios

  • hdparm: The hdparm command gets information about SATA devices, such as hard drives.
hdparm <device>

Hope this information helps you better understand how to check hardware and software versions of your Linux system from the command line. Please remember that the availability and output of some commands may vary depending on your Linux distribution and system configuration. It’s recommended to refer to your distribution’s official documentation and manual pages for the most accurate and up-to-date information.