Domov Operační systém Get Linux System and Hardware Details on the Command Line – VITUX

Get Linux System and Hardware Details on the Command Line – VITUX

2288 20/08/2021

When using Linux, you may need to know details about the system you are running or the hardware specifications you are using. As a normal Linux user or software developer, it is important for you to check the compatibility of a software or hardware system you want to install. The Linux command line contains several built-in commands to help you become familiar with the software and hardware platform you are working on. This tutorial will teach you how to use all these commands to get the sysinfo Linux details.

The commands and examples mentioned in this tutorial have been tested on Ubuntu 20.04 LTS and Debian 10.

Displaying Basic System Information on Linux Shell

To know the basic information about your system, you need to be familiar with the command-line utility called uname-short for unix name.

The uname Command

The uname command comes with multiple switches. The basic command as described below only returns the Kernel name:

$ uname

Output:

As you can see, the uname command when used without any switches only returns the kernel name i.e., Linux for my system.

Get the Linux Kernel Name

When you precisely want the command to print the kernel name, you will use the following command:

$ uname -s

Output:

The above output has displayed Linux as my kernel name.

Get the Linux Kernel Release

In order to print the release information of your kernel, use the following command:

Advertisement

$ uname -r

Output:

The above command has displayed the release number of my Linux

Get the Linux Kernel Version

In order to fetch the version of your kernel, use the following command:

$ uname -v

Output:

The above output shows the version number of my kernel.

Get Network Node Hostname

You can use the following command to print the network hostname of your node:

$ uname -n

You can also use the following command for the same purpose as it is more user-friendly:

$ uname --nodename

Output:

Both commands will display the same output. Please note that the hostname and the node name might not be the same for non-Linux systems.

Get Machine Hardware Architecture (i386, x86_64, sysinfo Linux)

In order to know the hardware architecture of the system you are working on, please use the following command:

$ uname --m

Output:

The output x86_64 signifies that I am using a 64-bit architecture. The output i686 means that a user is on a 32-bit system.

Get Processor Type

In order to know the type of processor you are using, please use the following command:

$ uname -p

Output:

This output shows that I am using a 64-bit processor.

Get Hardware Platform

In order to know the hardware platform you are using, please use the following command:

$ uname -i

Output:

In my case, the output is the same as that of the machine hardware name.

Get Operating System information

The following command will let you know the name of the operating system you are using:

$ uname -o

Output:

My Ubuntu machine has displayed the above output for my system.

Displaying All Information of Uname Command

The above commands have displayed system information as per the type of switch used. In case, you want to see all the system information at once, use the following command:

$ uname -a

Output:

You can see that the above output shows the complete list of system information for the user.

Displaying Detailed Hardware Information

Here we will describe the commands, other than uname, that are used to extract detailed hardware information of your system:

Get Hardware Information with lshw

The lshw utility enables you to fetch important hardware information such as memory, CPU, disks, etc. from your system. Please run the following command as a super user in order to view this information:

$ sudo lshw

Output:

The above output is a very detailed version of the hardware information of my system. You can also view a summary of hardware information as described in the following section.

Short Summary

In order to view the summary of your detailed hardware profile, please use the following command:

$ lshw -short

Output:

The above output is a column-wise summary of the hardware profile which is more readable.

Creating an HTML File

The lshw utility also lets you print your hardware profile to an HTML file as a superuser. Use the following command for this purpose:

$ sudo lshw -html > [filename.html]

Example:

$ sudo lshw -html > hardwareinfo.html

Output:

The above HTML file has been created at the /home/user/ folder.

Get CPU Information with lscpu

The lscpu utility lists detailed CPU information from the files sysfs and /proc/cpuinfo to your screen. This is how you can use this command:

$ lscpu

Output:

The above output displays CPU architecture, number of CPUs, cores, CPU family model, threads, CPU caches and much more.

Get Block Device Information with lsblk

The lsblk utility displays information about all the basic storage devices of your system such as hard drive, its partitions and the flash drives connected to your system.

$ lsblk

You can use the following command to view much more detailed information about all the devices:

$ lsblk -a

Output:

Get USB Device Information with lsusb

The lsusb command lists information about all the USB controllers and the devices connected to them. Please run the following command:

$ lsusb

You can also use the following command to view much detailed information about each USB device.

$ lsusb -v

Output:

This output displays all the USB controllers and the attached devices.

Get Information About Other Devices

You can also view information about the following devices of your system:

PCI devices

Command:

$ lspci

SCSI devices

Command:

$ lsscsi

SATA devices

Command:

$ hdparm [devicelocation] e.g. $ hdparm /dev/sda2

After practicing along with this tutorial, you will never fail to retrieve sysinfo about

Linux

and the underlying hardware of your system. This will help you check the system specifications and whether or not prospective hardware or software is compatible with your system.

Get Linux System and Hardware Details on the Command Line

Nejnovější: : Everything You Need to Know
Další: Dual
Populární články/span>
Back to top