- How to Get Hardware Info on Linux
- Fetching Basic System Information through the Uname Command
- The default behavior of the uname command
- Printing Kernel Name through uname
- Printing Kernel Release through uname
- Printing Kernel Version through uname
- Printing Machine Hardware Name through uname
- Printing Network Node Hostname through uname
- Printing Processor Type through uname
- Printing Hardware Platform through uname
- Printing Operating System name through uname
- Printing All the above information through uname
- Fetch Detailed Hardware Information
- Fetching Hardware Picture through the lshw command
- Fetching CPU Information through lscpu
- Fetching Block Device Information through lsblk
- Fetching USB Controllers Information through lsusb
- About the author
- Karim Buzdar
- 16 Commands to Check Hardware Information on Linux
- Hardware information
- 1. lscpu
- 2. lshw — List Hardware
- 3. hwinfo — Hardware Information
- 4. lspci — List PCI
- 5. lsscsi — List scsi devices
- 6. lsusb — List usb buses and device details
- 7. Inxi
- 8. lsblk — List block devices
- 9. df — disk space of file systems
- 10. Pydf — Python df
- 11. fdisk
- 12. mount
- 13. free — Check RAM
- 14. dmidecode
- 15. /proc files
- 16. hdparm
- Summary
- 48 thoughts on “ 16 Commands to Check Hardware Information on Linux ”
- Linux Command To Find the System Configuration And Hardware Information
- Linux cpu/hardware information
- Linux show free and used memory in the system
- Find ram speed and max supported ram by the server
- Linux find out the current running kernel version
- Find out information about the Linux distribution and version
- List all PCI devices
- List all USB devices
- List all block devices (hard disks, cdrom, and others)
- Display installed hard disk and size
- Display information about hardware RAID
- Say hello to lshw
- Dump all hardware information
How to Get Hardware Info on Linux
The commands mentioned in this article have been run on a Debian 10 Buster system but they can be replicated easily on most Linux distros.
We will be using the Debian command line, the Terminal, to fetch all the hardware information. You can open the Terminal application by entering the keywords ‘Terminal’ in the Application Launcher search as follows:
Use the Super/Windows key to access the Application Launcher.
Fetching Basic System Information through the Uname Command
The uname command, short for unix name, in Linux is used to print operating system and hardware information through the command line. Here is the syntax of the uname command:
By using various option switches with the command, you can choose to print either all or some specific information about your system.
The default behavior of the uname command
When you use the uname command without any switch, it prints the Linux Kernel name running on your system. Here is how you would use the command:
You can see how the uname command prints my Kernel name, which is Linux.
Printing Kernel Name through uname
Now, if you particularly want the uname command to print the Kernel name, you can use the -s switch with the command as follows:
We need to use the -s option in the scenario where we want to print the Kernel name along with some other information by using more than one switch.
Printing Kernel Release through uname
If you want the uname command to print the Kernel release you are using, you can use the -r switch with the command as follows:
You can see how the output prints the release number of the Linux kernel I am running.
Printing Kernel Version through uname
If you want the uname command to print the Kernel version you are using, you can use the v switch with the command as follows:
You can see how the output prints the version number of the Linux kernel I am running.
Printing Machine Hardware Name through uname
Using the -m switch with the uname command prints the hardware name of your machine.
This lets you know the hardware architecture of your system.
If you see x86_64 as the output, you are using a 64-bit machine. The output i686 indicates that you are using a 32-bit architecture.
Printing Network Node Hostname through uname
Using the -n switch with the uname command prints the node name/hostname of your system. The hostname is the identification that a system uses to communicate on a network.
The output of the uname command with the -n switch is the same as that of the ‘hostname’ command.
Printing Processor Type through uname
You can use the uname command as follows with the -p switch in order to print the processor type:
The above command did not produce a valid output on my Debian but it gives accurate information on Ubuntu.
Printing Hardware Platform through uname
The uname command with the -i switch is used to print the hardware platform you are on.
The above command also did not produce a valid output on my Debian but it gives accurate information on Ubuntu.
Printing Operating System name through uname
The uname command with the -o switch prints the operating system name that you are running.
The output of this command is GNU/Linux on all Linux distros.
Printing All the above information through uname
If you want the uname command to print all the information mentioned above, you can of course use the command with all the switches. The simple way, however, is to use only the -a switch with the uname command as follows:
You can see how the output displays all the information we have printed above, one by one.
Fetch Detailed Hardware Information
In this section, we will explain some more commands through which you can print a complete picture of your hardware specifications and also that of some individual hardware components.
Fetching Hardware Picture through the lshw command
Lshw, short for list hardware, is a command line utility that is used to print information about the hardware components of your system. It fetches information like CPU type & speed, disks, memory, bus speed, firmware, cache, etc, from the /proc files. If your system does not have this utility installed by default, you can install it through the following command as an administrator:
You can then fetch a detailed hardware report through the following command:
Running the command as sudo gives you access to the confidential information about the system.
If you are looking for a summary of the above information, you can get it through the following lshw usage:
You can see how the command prints a better readable hardware profile in a column-wise format.
You can print the output of the lshw command to an html file for sharing or for later use.
Run the following command as sudo in order to do so:
The html is saved in the current user’s home folder by default and this is how it looks like:
Fetching CPU Information through lscpu
The lscpu command fetches detailed CPU information from the /proc/cpuinfo and sysfs files. This is the exact command you will be using:
Fetching Block Device Information through lsblk
The lsblk command fetches detailed block device information such as your hard drives, flash drives, and their partitions. This is the exact command you will be using:
For even more information, you can use the following command:
Fetching USB Controllers Information through lsusb
The lsusb command fetches and prints detailed USB controllers information along with the connected hardware. This is the exact command you will be using:
For even more information, you can use the following command:
Here are some of the other commands you can use to get information about a particular kind of device:
Command | Information |
$ lspci | Fetch information about PCI devices connected to your system |
$ lsscsi | Fetch information about SCSI devices connected to your system |
$ hdparm [device_location] | Fetch information about SATA devices connected to your system. For example, use the command $ hdparm /dev/sda1 for information about sda 1 |
This was all you needed to know about printing all or specific system and hardware information on your Linux.
About the author
Karim Buzdar
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.
Источник
16 Commands to Check Hardware Information on Linux
Hardware information
Like for every thing, there are plenty of commands to check information about the hardware of your linux system.
Some commands report only specific hardware components like cpu or memory while the rest cover multiple hardware units.
This post takes a quick look at some of the most commonly used commands to check information and configuration details about various hardware peripherals and devices.
The list includes lscpu, hwinfo, lshw, dmidecode, lspci etc.
1. lscpu
The lscpu command reports information about the cpu and processing units. It does not have any further options or functionality.
2. lshw — List Hardware
A general purpose utility, that reports detailed and brief information about multiple different hardware units such as cpu, memory, disk, usb controllers, network adapters etc. Lshw extracts the information from different /proc files.
Check out the following post to learn more about lshw
3. hwinfo — Hardware Information
Hwinfo is another general purpose hardware probing utility that can report detailed and brief information about multiple different hardware components, and more than what lshw can report.
4. lspci — List PCI
The lspci command lists out all the pci buses and details about the devices connected to them.
The vga adapter, graphics card, network adapter, usb ports, sata controllers, etc all fall under this category.
Filter out specific device information with grep.
5. lsscsi — List scsi devices
Lists out the scsi/sata devices like hard drives and optical drives.
6. lsusb — List usb buses and device details
This command shows the USB controllers and details about devices connected to them. By default brief information is printed. Use the verbose option «-v» to print detailed information about each usb port
On the above system, 1 usb port is being used by the mouse.
7. Inxi
Inxi is a 10K line mega bash script that fetches hardware details from multiple different sources and commands on the system, and generates a beautiful looking report that non technical users can read easily.
8. lsblk — List block devices
List out information all block devices, which are the hard drive partitions and other storage devices like optical drives and flash drives
9. df — disk space of file systems
Reports various partitions, their mount points and the used and available space on each.
10. Pydf — Python df
An improved df version written in python, that displays colored output that looks better than df
11. fdisk
Fdisk is a utility to modify partitions on hard drives, and can be used to list out the partition information as well.
12. mount
The mount is used to mount/unmount and view mounted file systems.
Again, use grep to filter out only those file systems that you want to see
13. free — Check RAM
Check the amount of used, free and total amount of RAM on system with the free command.
14. dmidecode
The dmidecode command is different from all other commands. It extracts hardware information by reading data from the SMBOIS data structures (also called DMI tables).
Check out the man page for more details.
15. /proc files
Many of the virtual files in the /proc directory contain information about hardware and configurations. Here are some of them
16. hdparm
The hdparm command gets information about sata devices like hard disks.
Summary
Each of the command has a slightly different method of extracting information, and you may need to try more than one of them, while looking for specific hardware details. However they are available across most linux distros, and can be easily installed from the default repositories.
On the desktop there are gui tools, for those who do not want to memorise and type commands. Hardinfo, I-nex are some of the popular ones that provide detailed information about multiple different hardware components.
A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected] .
48 thoughts on “ 16 Commands to Check Hardware Information on Linux ”
How i can check memory in CPU. Example OPT, Efuse
Thanks for this. I’m just getting going on a VPS and this helped me discover they’d not given me the extra 1Gb I ordered. Very well explained.
Super happy with
inxi -Fx
more accurate than some of the other utilities.. for instance hwinfo was inaccurate for my Lenovo
Thanks for the great post!
Thank you! Your descriptions were useful and well explained!
Источник
Linux Command To Find the System Configuration And Hardware Information
W hat is the command to find the system configuration on Linux operating system using command line (text) mode?
On Linux based system most of the hardware information can be extracted from /proc file system, for example display CPU and Memory information, enter:
Tutorial details | |
---|---|
Difficulty level | Intermediate |
Root privileges | Yes |
Requirements | None |
Est. reading time | 10 minutes |
cat /proc/meminfo
cat /proc/cpuinfo
The following list summarizes commands to get various hardware from the system:
Linux cpu/hardware information
Use any one of the following command:
# less /proc/cpuinfo
OR
# lscpu
Sample outputs:
Linux show free and used memory in the system
Use any one of the following command:
# cat /proc/meminfo
OR
# free
# free -m
# free -mt
# free -gt
Sample outputs:
You can also run top/htop/atop commands to see used and free memory and cpu usage and more:
# top
# htop
# atop
Find ram speed and max supported ram by the server
# dmidecode —type 17
# lshw -short -C memory
# perl memconf.v3.06.pl -v
Sample outputs:
Linux find out the current running kernel version
Type the following command:
# cat /proc/version
Sample outputs:
OR use the following command:
# uname -mrs
# uname -a
Find out information about the Linux distribution and version
# lsb_release -a
Sample outputs:
OR use the following command:
$ cat /etc/*release*
Sample outputs:
List all PCI devices
# lspci
Sample outputs:
List all USB devices
# lsusb
Sample outputs:
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
List all block devices (hard disks, cdrom, and others)
# lsblk
Sample outputs:
Display installed hard disk and size
# fdisk -l | grep ‘^Disk /dev/’
Sample outputs:
Display information about hardware RAID
See info about Adaptec hardware RAID:
# arcconf getconfig DEV
# /usr/StorMan/arcconf getconfig 1
See info about 3ware hardware RAID:
# tw_cli /dev show
# tw_cli /c0 show
Say hello to lshw
The lshw is a small command line tool to extract detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc. on DMI-capable x86 or IA-64 systems and on some PowerPC machines (PowerMac G4 is known to work):
# lshw | more
# lshw -html > output.htmlq
# lshw -short | less
Sample outputs:
Dump all hardware information
Type the following command to see your motherboard, cpu, vendor, serial-numbers, RAM, disks, and other information directly from the system BIOS:
# dmidecode | less
Sample outputs:
Источник