Linux commands to display your hardware information

Get the details on what's inside your computer from the command line.
684 readers like this
684 readers like this
computer screen

There are many reasons you might need to find out details about your computer hardware. For example, if you need help fixing something and post a plea in an online forum, people will immediately ask you for specifics about your computer. Or, if you want to upgrade your computer, you'll need to know what you have and what you can have. You need to interrogate your computer to discover its specifications.

The easiest way is to do that is with one of the standard Linux GUI programs:

  • i-nex collects hardware information and displays it in a manner similar to the popular CPU-Z under Windows.
  • HardInfo displays hardware specifics and even includes a set of eight popular benchmark programs you can run to gauge your system's performance.
  • KInfoCenter and Lshw also display hardware details and are available in many software repositories.

Alternatively, you could open up the box and read the labels on the disks, memory, and other devices. Or you could enter the boot-time panels—the so-called UEFI or BIOS panels. Just hit the proper program function key during the boot process to access them. These two methods give you hardware details but omit software information.

Or, you could issue a Linux line command. Wait a minute… that sounds difficult. Why would you do this?

Sometimes it's easy to find a specific bit of information through a well-targeted line command. Perhaps you don't have a GUI program available or don't want to install one.

Probably the main reason to use line commands is for writing scripts. Whether you employ the Linux shell or another programming language, scripting typically requires coding line commands.

Many line commands for detecting hardware must be issued under root authority. So either switch to the root user ID, or issue the command under your regular user ID preceded by sudo:

sudo <the_line_command>

and respond to the prompt for the root password.

This article introduces many of the most useful line commands for system discovery. The quick reference chart at the end summarizes them.

Hardware overview

There are several line commands that will give you a comprehensive overview of your computer's hardware.

The inxi command lists details about your system, CPU, graphics, audio, networking, drives, partitions, sensors, and more. Forum participants often ask for its output when they're trying to help others solve problems. It's a standard diagnostic for problem-solving:

inxi -Fxz

The -F flag means you'll get full output, x adds details, and z masks out personally identifying information like MAC and IP addresses.

The hwinfo and lshw commands display much of the same information in different formats:

hwinfo --short


lshw -short

The long forms of these two commands spew out exhaustive—but hard to read—output:




CPU details

You can learn everything about your CPU through line commands. View CPU details by issuing either the lscpu command or its close relative lshw:



lshw -C cpu

In both cases, the last few lines of output list all the CPU's capabilities. Here you can find out whether your processor supports specific features.

With all these commands, you can reduce verbiage and narrow any answer down to a single detail by parsing the command output with the grep command. For example, to view only the CPU make and model:

lshw -C cpu | grep -i product

To view just the CPU's speed in megahertz:

lscpu | grep -i mhz

or its BogoMips power rating:

lscpu | grep -i bogo

The -i flag on the grep command simply ensures your search ignores whether the output it searches is upper or lower case.


Linux line commands enable you to gather all possible details about your computer's memory. You can even determine whether you can add extra memory to the computer without opening up the box.

To list each memory stick and its capacity, issue the dmidecode command:

dmidecode -t memory | grep -i size

For more specifics on system memory, including type, size, speed, and voltage of each RAM stick, try:

lshw -short -C memory

One thing you'll surely want to know is is the maximum memory you can install on your computer:

dmidecode -t memory | grep -i max

Now find out whether there are any open slots to insert additional memory sticks. You can do this without opening your computer by issuing this command:

lshw -short -C memory | grep -i empty

A null response means all the memory slots are already in use.

Determining how much video memory you have requires a pair of commands. First, list all devices with the lspci command and limit the output displayed to the video device you're interested in:

lspci | grep -i vga

The output line that identifies the video controller will typically look something like this:

00:02.0 VGA compatible controller: Intel Corporation 82Q35 Express Integrated Graphics Controller (rev 02)

Now reissue the lspci command, referencing the video device number as the selected device:

lspci -v -s 00:02.0

The output line identified as prefetchable is the amount of video RAM on your system:

Memory at f0100000 (32-bit, non-prefetchable) [size=512K]
I/O ports at 1230 [size=8]
Memory at e0000000 (32-bit, prefetchable) [size=256M]
Memory at f0000000 (32-bit, non-prefetchable) [size=1M]

Finally, to show current memory use in megabytes, issue:

free -m

This tells how much memory is free, how much is in use, the size of the swap area, and whether it's being used. For example, the output might look like this:

              total        used        free     shared    buff/cache   available
Mem:          11891        1326        8877      212        1687       10077
Swap:          1999           0        1999

The top command gives you more detail on memory use. It shows current overall memory and CPU use and also breaks it down by process ID, user ID, and the commands being run. It displays full-screen text output:


Disks, filesystems, and devices

You can easily determine whatever you wish to know about disks, partitions, filesystems, and other devices.

To display a single line describing each disk device:

lshw -short -C disk

Get details on any specific SATA disk, such as its model and serial numbers, supported modes, sector count, and more with:

hdparm -i /dev/sda

Of course, you should replace sda with sdb or another device mnemonic if necessary.

To list all disks with all their defined partitions, along with the size of each, issue:


For more detail, including the number of sectors, size, filesystem ID and type, and partition starting and ending sectors:

fdisk -l

To start up Linux, you need to identify mountable partitions to the GRUB bootloader. You can find this information with the blkid command. It lists each partition's unique identifier (UUID) and its filesystem type (e.g., ext3 or ext4):


To list the mounted filesystems, their mount points, and the space used and available for each (in megabytes):

df -m

Finally, you can list details for all USB and PCI buses and devices with these commands:





Linux offers tons of networking line commands. Here are just a few.

To see hardware details about your network card, issue:

lshw -C network

Traditionally, the command to show network interfaces was ifconfig:

ifconfig -a

But many people now use:

ip link show


netstat -i

In reading the output, it helps to know common network abbreviations:

Abbreviation Meaning
lo Loopback interface
eth0 or enp* Ethernet interface
wlan0 Wireless interface
ppp0 Point-to-Point Protocol interface (used by a dial-up modem, PPTP VPN connection, or USB modem)
vboxnet0 or vmnet* Virtual machine interface

The asterisks in this table are wildcard characters, serving as a placeholder for whatever series of characters appear from system to system.

To show your default gateway and routing tables, issue either of these commands:

ip route | column -t


netstat -r


Let's conclude with two commands that display low-level software details. For example, what if you want to know whether you have the latest firmware installed? This command shows the UEFI or BIOS date and version:

dmidecode -t bios

What is the kernel version, and is it 64-bit? And what is the network hostname? To find out, issue:

uname -a

Quick reference chart

This chart summarizes all the commands covered in this article:

Display info about all hardware inxi -Fxz              --or--

hwinfo --short     --or--

lshw  -short
Display all CPU info lscpu                  --or--

lshw -C cpu
Show CPU features (e.g., PAE, SSE2) lshw -C cpu | grep -i capabilities
Report whether the CPU is 32- or 64-bit lshw -C cpu | grep -i width
Show current memory size and configuration dmidecode -t memory | grep -i size    --or--

lshw -short -C memory
Show maximum memory for the hardware dmidecode -t memory | grep -i max
Determine whether memory slots are available lshw -short -C memory | grep -i empty

(a null answer means no slots available)
Determine the amount of video memory lspci | grep -i vga

then reissue with the device number;

for example:  lspci -v -s 00:02.0

The VRAM is the prefetchable value.
Show current memory use free -m    --or--

List the disk drives lshw -short -C disk
Show detailed information about a specific disk drive hdparm -i /dev/sda

(replace sda if necessary)
List information about disks and partitions lsblk      (simple)      --or--

fdisk -l   (detailed)
List partition IDs (UUIDs) blkid
List mounted filesystems, their mount points,

and megabytes used and available for each
df -m
List USB devices lsusb
List PCI devices lspci
Show network card details lshw -C network
Show network interfaces ifconfig -a       --or--

ip link show   --or--

netstat -i
Display routing tables ip route | column -t  --or--

netstat -r
Display UEFI/BIOS info dmidecode -t bios
Show kernel version, network hostname, more uname -a

Do you have a favorite command that I overlooked? Please add a comment and share it.

What to read next
Howard Fosdick is an independent consultant who works hands-on as a DBA/SA. He's written several technical books, many articles, and is a popular conference speaker.


inxi seem to be quite useful integral script to get various Linux system information.

# inxi -V
inxi 2.2.21-00 (2015-05-13)
Program Location: /usr/local/sbin
IRC: channel: #smxi

inxi - the universal, portable, system information tool for console and irc.

This program started life as a fork of Infobash 3.02:
Copyright (C) 2005-2007 Michiel de Boer a.k.a. locsmif.
Subsequent changes and modifications (after Infobash 3.02):
Copyright (C) 2008-2015 Harald Hope, Scott Rogers, aka h2 &trash80.

#inxi -h

inxi supports the following options. You can combine them, or list them one
by one. Examples: inxi -v4 -c6 OR inxi -bDc 6. If you start inxi with no
arguments, it will show the short form.

The following options if used without -F, -b, or -v will show just option
line(s): A, C, D, G, I, M, N, P, R, S, f, i, m, n, o, p, l, u, r, s, t - you
can use these alone or together to show just the line(s) you want to see. If
you use them with -v [level], -b or -F, it will show the full output for that
line along with the output for the chosen verbosity level.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Output Control Options:
-A Audio/sound card information.
-b Basic output, short form. Like inxi -v 2, only minus hard disk names.
-c Color schemes. Scheme number is required. Color selectors run a color
selector option prior to inxi starting which lets you set the config
file value for the selection.
Supported color schemes: 0-32 Example: inxi -c 11
Color selectors for each type display (NOTE: irc and global only show
safe color set):
94 Console, out of X
95 Terminal, running in X - like xTerm
96 Gui IRC, running in X - like Xchat, Quassel, Konversation etc.
97 Console IRC running in X - like irssi in xTerm
98 Console IRC not in X
99 Global - Overrides/removes all settings. Setting specific removes
-C CPU output, including per CPU clockspeed and max CPU speed (if
-d Optical drive data. Same as -Dd. See also -x and -xx.
-D Full hard Disk info, not only model, ie: /dev/sda ST380817AS 80.0GB.
See also -x and -xx. Disk total used percentage includes swap partition
-f All cpu flags, triggers -C. Not shown with -F to avoid spamming. ARM
cpus show 'features'.
-F Full output for inxi. Includes all Upper Case line letters, plus -s and
-n. Does not show extra verbose options like -d -f -l -m -o -p -r -t -u
-G Graphic card information (card, display server type/version,
resolution, glx renderer, version).
-i Wan IP address, and shows local interfaces (requires ifconfig network
tool). Same as -Nni. Not shown with -F for user security reasons, you
shouldn't paste your local/wan IP.
-I Information: processes, uptime, memory, irc client (or shell type),
inxi version.
-l Partition labels. Default: short partition -P. For full -p output, use:
-pl (or -plu).
-m Memory (RAM) data. Physical system memory array(s), capacity, how many
devices (slots) supported, and individual memory devices (sticks of
memory etc). For devices, shows device locator, size, speed, type
(like: DDR3). Also see -x, -xx, -xxx
-M Machine data. Motherboard, Bios, and if present, System Builder (Like
Lenovo). Older systems/kernels without the required /sys data can use
dmidecode instead, run as root. Dmidecode can be forced with -! 33
-n Advanced Network card information. Same as -Nn. Shows interface, speed,
mac id, state, etc.
-N Network card information. With -x, shows PCI BusID, Port number.
-o Unmounted partition information (includes UUID and LABEL if available).
Shows file system type if you have file installed, if you are root OR
if you have added to /etc/sudoers (sudo v. 1.7 or newer)
Example: ALL = NOPASSWD: /usr/bin/file
-p Full partition information (-P plus all other detected partitions).
-P Basic partition information (shows what -v 4 would show, but without
extra data). Shows, if detected: / /boot /home /tmp /usr /var. Use -p
to see all mounted partitions.
-r Distro repository data. Supported repo types: APT; PACMAN; PISI;
-R RAID data. Shows RAID devices, states, levels, and components, and
extra data with -x/-xx. md-raid: If device is resyncing, shows resync
progress line as well.
-s Sensors output (if sensors installed/configured): mobo/cpu/gpu temp;
detected fan speeds. Gpu temp only for Fglrx/Nvidia drivers. Nvidia
shows screen number for > 1 screens.
-S System information: host name, kernel, desktop environment (if in X),
-t Processes. Requires extra options: c (cpu) m (memory) cm (cpu+memory).
If followed by numbers 1-20, shows that number of processes for each
type (default: 5; if in irc, max: 5): -t cm10
Make sure to have no space between letters and numbers (-t cm10 -
right, -t cm 10 - wrong).
-u Partition UUIDs. Default: short partition -P. For full -p output, use:
-pu (or -plu).
-v Script verbosity levels. Verbosity level number is required. Should not
be used with -b or -F
Supported levels: 0-7 Example: inxi -v 4
0 Short output, same as: inxi
1 Basic verbose, -S + basic CPU + -G + basic Disk + -I.
2 Networking card (-N), Machine (-M) data, shows basic hard disk
data (names only), and, if present, basic raid (devices only, and
if inactive, notes that). similar to: inxi -b
3 Advanced CPU (-C), network (-n) data, and switches on -x advanced
data option.
4 Partition size/filled data (-P) for (if present): /, /home,
/var/, /boot. Shows full disk data (-D).
5 Audio card (-A); sensors (-s), memory/ram (-m), partition
label (-l) and UUID (-u), short form of optical drives, standard
raid data (-R).
6 Full partition (-p), unmounted partition (-o), optical drive
(-d), full raid; triggers -xx.
7 Network IP data (-i); triggers -xxx.
-w Local weather data/time. To check an alternate location, see:
-W . For extra weather data options see -x, -xx, and -xxx.
-W Supported options for : postal code; city,
state/country; latitude/longitude. Only use if you want the weather
somewhere other than the machine running inxi. Use only ascii
characters, replace spaces in city/state/country names with '+'.
Example: inxi -W new+york,ny
-x Adds the following extra data (only works with verbose or line output,
not short form):
-C CPU Flags, Bogomips on Cpu;
-d Extra optical drive data; adds rev version to optical drive.
-D Hdd temp with disk data if you have hddtemp installed, if you are
root OR if you have added to /etc/sudoers (sudo v. 1.7 or newer)
Example: ALL = NOPASSWD: /usr/sbin/hddtemp
-G Direct rendering status for Graphics (in X).
-G (for single gpu, nvidia driver) screen number gpu is running on.
-i IPv6 as well for LAN interface (IF) devices.
-I System GCC, default. With -xx, also show other installed GCC
versions. If running in console, not in IRC client, shows shell
version number, if detected. Init/RC Type and runlevel (if
-m Part number; Max memory module size (if available).
-N -A Version/port(s)/driver version (if available) for Network/Audio;
-N -A -G Network, audio, graphics, shows PCI Bus ID/Usb ID number of card.
-R md-raid: Shows component raid id. Adds second RAID Info line:
raid level; report on drives (like 5/5); blocks; chunk size;
bitmap (if present). Resync line, shows blocks synced/total
blocks. zfs-raid: Shows raid array full size; available size;
portion allocated to RAID
-S Desktop toolkit if avaliable (GNOME/XFCE/KDE only); Kernel gcc
-t Memory use output to cpu (-xt c), and cpu use to memory (-xt m).
-w -W Wind speed and time zone (-w only).
-xx Show extra, extra data (only works with verbose or line output, not
short form):
-A Chip vendor:product ID for each audio device.
-C Minimum CPU speed, if available.
-D Disk serial number.
-G Chip vendor:product ID for each video card.
-I Other detected installed gcc versions (if present). System
default runlevel. Adds parent program (or tty) for shell info if
not in IRC (like Konsole or Gterm). Adds Init/RC (if found)
version number.
-m Manufacturer, Serial Number, single/double bank (if found).
-M Chassis information, bios rom size (dmidecode only), if data for
either is available.
-N Chip vendor:product ID for each nic.
-R md-raid: Superblock (if present); algorythm, U data. Adds system
info line (kernel support,read ahead, raid events). If present,
adds unused device line. Resync line, shows progress bar.
-S Display manager (dm) in desktop output, if in X (like kdm, gdm3,
-w -W Humidity, barometric pressure.
-@ 11-14 Automatically uploads debugger data tar.gz file to EG: inxi -xx@14
-xxx Show extra, extra, extra data (only works with verbose or line output,
not short form):
-m Width of memory bus, data and total (if present and greater than
data); Detail, if present, for Type; module voltage, if
-S Panel/shell information in desktop output, if in X (like
gnome-shell, cinnamon, mate-panel).
-w -W Location (uses -z/irc filter), weather observation time, wind
chill, heat index, dew point (shows extra lines for data where
-y Required extra option: integer, 80 or greater. Set the output line
width max. Overrides IRC/Terminal settings or actual widths. If used
with -h, put -y option first. Example: inxi -y 130
-z Security filters for IP/Mac addresses, location, user home directory
name. Default on for irc clients.
-Z Absolute override for output filters. Useful for debugging networking
issues in irc for example.

Additional Options:
-h --help This help menu.
-H This help menu, plus developer options. Do not use dev options
in normal operation!
--recommends Checks inxi application dependencies + recommends, and
directories, then shows what package(s) you need to install to
add support for that feature.
-U Auto-update script. Will also install/update man page. Note: if
you installed as root, you must be root to update, otherwise
user is fine. Man page installs require root user mode.
-V --version inxi version information. Prints information then exits.

Debugging Options:
-% Overrides defective or corrupted data.
-@ Triggers debugger output. Requires debugging level 1-14 (8-10 - logging
of data). Less than 8 just triggers inxi debugger output on screen.
1-7 On screen debugger output
8 Basic logging
9 Full file/sys info logging
10 Color logging.
The following create a tar.gz file of system data, plus collecting the
inxi output to file. To automatically upload debugger data tar.gz file
to inxi -xx@ <11-14>
For alternate ftp upload locations:
Example: inxi -! -xx@ 14
11 With data file of xiin read of /sys.
12 With xorg conf and log data, xrandr, xprop, xdpyinfo, glxinfo etc.
13 With data from dev, disks, partitions, etc., plus xiin data file.
14 Everything, full data collection.

Advanced Options:
-! 31 Turns off hostname in output. Useful if showing output from servers etc.
-! 32 Turns on hostname in output. Overrides global B_SHOW_HOST='false'
-! 33 Forces use of dmidecode data instead of /sys where relevant (-M).

Instead of a comment, perhaps you should consider turning this information an article for

In reply to by Xipe Totec

Thank you Howard. 'Makes my day easier.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.