One of the most activities of a Linux administrator or user is to get information about their Linux system. Observing the status of CPU, software, hardware, and more is possible by having Linux system knowledge. 23 Commands to Get System and Hardware Information in Linux are what you will review in this article.
When you buy Linux VPS, you will need to install and use different software or hardware on it. Although there are programs that can graphically show Linux system information, in this case, we will use the built-in commands. Ultimately, you will know how to use related Linux commands to display your considered system information.
Most Used Commands to Check out Linux System Information
There are numerous installed and built-in commands available for Linux. In the following of this tutorial, we will discuss both kinds of commands and describe how to install the ones that haven’t been done so yet to let you use and get system and hardware information in Linux.
Linux offers a number of commands that let you view system information. So, let’s see what the best commands are for displaying system-related data in the terminal. Also, using the Linux commands in this guide allow you to get CPU information such as architecture, number of cores, and clock speed. Knowing system and hardware information in Linux help you to use it in a variety of circumstances, but device debugging is probably where it will be most useful.
Let’s go through the steps of this tutorial and get familiar with the most used Linux commands to get the system and hardware information in Linux.
1. Using Lscpu Command to Get CPU Information
Under Linux, information regarding the system CPU is provided through the lscpu command line utility. The following information about the CPU’s architecture (threads, CPU caches, cores, CPU family model, number of CPUs, etc.) is obtained by this command from the /proc/cpuinfo and “sysfs” files and shown in the terminal:
Additionally, you can filter the output using grep or other text-processing commands to only extract the information you require:
lscpu | grep -i bogo
The above command shows you the information of BogoMips power rating. And the below command gives you the CPU’s speed in hertz information.
lscpu | grep -i hz
2. Install & Use Inxi CLI to Get Hardware Information
The inxi command displays a list of details about your system’s sensors, drives, partitions, networking, audio, graphics, CPU, and other components. Linux does not come with this command pre-installed, but you can install it by entering the following command:
sudo apt install inxi -y
When the installation is completed, use the command below to get related information about your hardware:
Now, you must have System and Hardware information in Linux.
Then to get the standard output, type:
3. Install & Use Hwinfo CLI to Test Hardware
Another hardware testing tool that offers comprehensive information on many components is “hwinfo”. Since the Linux distributions do not come with hwinfo pre-installed, run the command below to download it to get system and Hardware Information in Linux:
sudo apt install hwinfo -y
To get the system information, run:
While it is a little difficult to read the long output, use the command below to reduce the details:
4. Install & Use Lstopo CLI to View the Topology of a Linux System
The lstopo command displays the topology of a Linux system. To do this, run:
sudo apt install hwloc -y
To have access to a variety of data, including shared caches, NUMA memory nodes, threads, processor cores, and CPU packages, use the following command:
5. Using Lshw Command to List all Hardware Devices
Another command to get system and Hardware Information in Linux is lshw. To get an accurate representation of the hardware setup, run:
In this way, you will retrieve crucial hardware data from your system, including memory, CPU, drives, etc., using the lshw utility.
You can also obtain a summary of hardware information that simply lists particular hardware components. To shorten the previous command, type:
As a superuser, the lshw software also enables you to output comprehensive details on your hardware profile and hardware components to an HTML file. For this, use the following command:
sudo lshw -html > [filename.html]
6. Using dmidecode Command to List all the Hardware
DMI stands for Desktop Management Interface. Running the dmidecode command helps you to list all the hardware as seen by the DMI interface. The dmidecode command displays the hardware-related data from the DMI tables (SMBOIS data structures) in a readable manner, including the serial number, memory, BIOS information, RAM (DIMMs), and processor. Here is its general syntax:
sudo dmidecode -t <option>
To check the details of the system, you can use the dmidecode command to get further details of your system. To know about BIOS version, motherboard, and processor run:
sudo dmidecode -t system
sudo dmidecode -t bios
sudo dmidecode -t processor
Also, you can use the dmidecode command when you need to view all Linux useful information:
sudo dmidecode -q
7. Using proc File Command to Get Running Processes Information
The proc command, which offers important information about all presently executing processes, is regarded as the information and control hub of the kernel. Additionally, this instruction offers a channel of communication between user space and kernel space. You can find a lengthy list of virtual files and directories by running ls on the /proc folder:
also, you can get information about system version, CPU, SCSI/SATA devices, partitions, memory, etc. For example, to view the system version, run:
As an easy way to get the total available memory, you can use the following command to read the content of the /proc/meminfo file:
To get information about the disks and their partitions, run:
8. Using Uname Command to View Basic Information on CPU Architecture
Computer software in Unix and Unix-like computer operating systems is called the “uname” command line utility. It offers information about the operating system that is currently running on the machine, such as its name, version, kernel, and processors. It comes with multiple switches.
The below command as its basic syntax returns the Kernel name:
Use the following command when you specifically want to print the kernel name:
To list all the information at once, use the following command:
To get the Linux Kernel release, type:
In this way, you can view the release number of your Linux. And, to fetch the version of your kernel, run the command below:
You can also use the following command to get your network Node hostname:
Please be aware that on non-Linux systems, the host and node names could differ.
And to view the machine hardware architecture, type:
For example, the output x86_64 denotes a 64-bit architecture and the output i686 indicates a 32-bit system.
Run the following command to view the type of processor you are using:
To get the hardware platform you are currently using, type:
Running the following command gives you the name of the operating system you are using:
9. Install & Use Ifconfig CLI Tool to View the Network Interfaces
For network interface settings, use the ifconfig system administration tool. This command is also used frequently in the system startup scripts of operating systems. The “ifconfig” command is managed by the Net-tools software. Use the following command to install it:
sudo apt install net-tools -y
Then, to show the network interfaces, run:
10. Using Netstat Command to Get Active Internet Connections & Domain Sockets Information
The contents of different network-related data structures are shown for connections that are currently active on the system by the netstat command. The straightforward “netstat” command provides details on all current domain sockets and internet connections:
To view the status of all configured interfaces, type:
Use the following command to get the default gateways and routing tables:
11. Install & Use Ip CLI Tool to Configure the Network Interfaces
As a network and system administrator, you can use the ip command as a net tool. First, you must install it:
sudo apt install net-tools -y
This command is frequently used by Linux users to set up network interfaces. Any of the commands listed below can be used to discover the network interfaces:
ip link show
The routing tables and default gateways can also be known by the commands below:
ip route | column -t
12. Using Hdparm Command to Manage Hard Disk & Disk Devices
To handle the hard drive and disk devices in Linux, use the hdparm command, sometimes known as “hard disk parameter”. This command can be used to verify the DMA and acoustic management settings, modify the write interval, adjust statistics pertaining to the hard drive, etc.
Using the hdparm command, you may obtain extensive information about any given SATA drive, including the sector count, supported modes, and serial number:
sudo hdparm /dev/sda
13. Using Lsblk Command to Get Block Devices Details
To view the block device’s details such as disks, hard drives, flash drives, etc., and their partitions, you can use the Lsblk command.
Run the command below to view all blocks devices:
14. Using Lsscsi Command to Get SATA/SCSI Devices Information
In Linux, the lsscsi command is used to obtain information regarding SATA/SCSI devices. If this utility isn’t already installed on your computer, you can quickly add it by running the command:
sudo apt install lsscsi -y
To view a row of all SCSI devices that are currently connected to the system, run:
15. Using Fdisk Command To Get Related Information about Filesystems, Disks, and Devices
The disk partition table on a hard drive can be altered, created, viewed, deleted, copied, moved, and resized using this dialog-driven command.
sudo fdisk -l
The above command will list details such as terminating sectors, partition commencing, filesystem type and ID, and sector size.
16. Using DF Command to Get Information on File System and Disk Space
So far, you learned some commands to get System and Hardware information in Linux. The mounted file system, the amount of disk space used and available for it, and the mount points can all also be found with the “df” command.
17. Using Blkid Command To Check the Content Type
The blkid command uses the content metadata to determine the type of content, such as swap, filesystem, and characteristics, and works with the libuuid(3) library.
You can use this command to identify the mountable partitions:
In this way, you can view the list of the unique identifier of the partition (UUID) and its filesystem type.
18. Using Lsusb Command to View Information on USB buses & Devices Connected to them
The lsusb command in Linux provides details on USB buses and the devices connected to them. Properties like type, class, BUS, speed, etc. are included in this information.
It prints information about the connected USB devices.
To find out more specifics about each USB device attached, execute the command below:
19. Using Lspci Command to Print Devices & PCI buses Information
The lspci command outputs comprehensive information on all PCI buses, devices, and connections on a Linux system. This command gives users of different operating systems access to the PCI configuration area and is based on the widely used portable library libpci.
One of the crucial parts of connecting to the internet and other local networks is the network card that is installed on your Linux system. Use the commands listed below to learn its model, maker, and other details without having to operate the system’s case.
lspci | grep -i 'eth'
To find out the IP address and available active ethernet interfaces, run:
20. Using Mount command to mount and View Filesystems
To mount and display filesystems in Linux, use the mount command.
If you found the output of the above command hard to analyze, use the command below to acquire precise results:
mount | column -t
21. Using free Command to View the Memory Status
The free command offers information on the overall amount of memory available and the amount of memory being used. By default, it prints the output in bytes.
Run the following command to print free available RAM.
22. Using top Command to Get the Total Memory
The top command is useful for both acquiring the total amount of memory and for keeping track of memory consumption in real-time:
To check out the Process ID, Unique number of the process (PID) of the process, run:
A text-based tool called a top provides detailed details on all presently running processes in real-time. Ctrl + C to close it.
23. Get complete Linux OS information
It is also possible to find out what version of the Linux operating system we are using when running a Linux server and after updating or installing it using the command terminal.
To get release info only, type:
Additionally, to explore more about any of the commands, add -h to the end of your considered command line.
Knowing about these commands lets you retrieve sysinfo about Linux and the underlying hardware of your system. Also, you can use this to determine whether potential hardware or software is compatible with your system and to check the system requirements.
The lshw command. It also prints bus speed, memory configuration, CPU version, and other Power PCs that run on the backend.
lspci command gives you about PCI devices.
In this article, you reviewed 23 Commands to get System and Hardware information in Linux. Using the discussed commands in this guide allows you to learn more about your Linux system and get information about hardware devices (CPUs, RAM, hard disks, PCI, and USB) connected to it. Now, you must know how to use your Linux system, Plan for growth and upgrades, contact vendors for assistance, install drivers and the necessary software and apply fixes.
Share with us if we have missed any commands which are used for getting System and Hardware information in Linux. If you are interested in Linux, find out the A to Z Linux commands to dive into the Linux ocean.