Getting information about system and hardware is important part of System Administration job. There are a lot of different tools that provide information about system and hardware. In this post, we will look at how to get CPU, memory, disk, bus, USB, disk … information simple from a Linux system.
Print Operating System
Linux system administrators generally work a different type of Operating systems which are similar to Linux. To get detailed operation system information like Unix, BSD, etc. uname
command can be used.
$ uname

Print Hostname
The hostname is used for the system to identify and name them. Displaying or printing hostname can be done in different ways.
$ hostname
OR
$ uname -n

Print Architecture
Computer architecture is generally related with CPU running on the system. There is a different type of CPU’s used in server hardware like x86, Arm, PowerPC, etc.
$ uname -m

In this situation, our system is x86 and 64-bit operating system.
Print Kernel Information
The kernel is the core of an operating system. There are different kernel used in Unix like operating systems. Other than Linux, BSD, Solaris are alternative kernels.
$ uname -r

List All Hardware
To get a fast and furious way about the all hardware lshw
command can be used. This command requires root privileges to probe in detail.
$ sudo lshw

List Hardware As Table
The previous output maybe seems a bit untidy. The alternative is sorting the output of lshw
command.
$ sudo lshw -short

List Hardware To Html
While working with command-line interface bash and related tools are useful. But if we want to get information in HTML form lshw
provides HTML web page output for the list of hardware.
$ sudo lshw -html > systeminformation.html

Print CPU Information
CPU related information is important. The performance and capabilities can get from CPU information. CPU’s, core, CPU family, CPU cache, threads, supported instruction sets, hypervisor vendor, virtualization type CPU frequency and speed information can get with the following command.
$ lscpu

Print Block Device/Disk Information
Installed disks can get with lsblk
command. lsblk command will provide information about name, major, minor numbers size, read-write status, type and mount point of currently installed disk devices.
$ lsblk

Print USB Information
USB provides a flexible way to connect devices to the computers. To list USB controllers and connected devices to a Linux system following command can be used. Also, USB devices manufacturer and memory address ranges can be learned with this command.
$ lsusb

Print PCI Information
PCI is the main way to connect different type high data rate devices like graphics cards, network adapters, USB ports, etc. PCI bus connected devices can be listed with lspci
$ lspci

From this output, we can see that Intel USB controllers are connected to the PCI. QXL graphic controller and Virtio Ethernet controller are also connected from this PCI bus.
Print Detailed PCI Information
By using previous lspci
command with the -v
parameter more detailed information about the PCI devices can get like below.
$ lspci -v

Print SCSI Information
SCSI is another popular BUS used to connect different type of devices to the Linux systems. SCSI interface devices are pricier than PCI because they are generally used in enterprise server hardware. SCSI information similar to the PCI can be listed with the following command.
$ lsscsi
Print SATA/Disk Information
Disk device information can get with the hdparm
command like below.
$ sudo hdparm /dev/sda

Print File System Information
File system information can be gathered by using fdisk
command. Although fdisk
can be used for creating partitions, file systems and other disk-related media also provides file system information with the -l
parameter.
$ sudo fdisk -l

We can see that the following information is provided with the fdisk command.
- Units
- Sector Size
- I/O Size
- Disklabel type
- Disk identifier
- Device name
- Boot Enabled
- Start Sector Number
- End Sector Number
- Size in human-readable format
- Partition type id
- Type name
Print BIOS Information
Bios is the first operating system when the computer starts. It is a very basic operating system which provides a baseline for real operating systems like Linux. BIOS provide wealth information about the hardware and itself. This information can get with the following command.
$ sudo dmidecode -t bios

Print Chassis Information
Chassis is the mainboard and related part of a system. Enterprise server hardware manufacturers put details into its chassis like serial number, model, etc. This information can get with the following command.
$ sudo dmidecode -t system

1 thought on “Linux Commands To Collect System and Hardware Information”