Useful Linux commands for querying your computer for hardware information.

Posted: October 19, 2016. At: 11:11 PM. This was 11 months ago. Post ID: 4736

The iostatcommand is another good way to get information about the hardware in your computer. This command displays information about the average CPU usage as well as reads and writes to your hard disk partitions.

To install this utility, run this command.

ubuntu ~ $ sudo apt-get install sysstat

Then run iostat to get hardware information.

ubuntu ~ $ iostat
Linux 3.13.0-63-generic (ip-172-31-20-16)       10/18/2016      _x86_64_        (1 CPU)
 
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.01    0.00    0.01    0.01    0.00   99.96
 
Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
xvda              0.14         0.11         2.07    1497914   28817728

A simple command to list the number of running processes.

ubuntu ~ $ ps ax | wc -l
113

If you want to list the installed hardware on your computer then use the lsusb command; this will perform this task admirably.

ubuntu ~ $ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 009 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 010 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 002: ID 058f:6362 Alcor Micro Corp. Flash Card Reader/Writer
Bus 005 Device 002: ID 09da:0006 A4 Tech Co., Ltd Optical Mouse WOP-35 / Trust 450L Optical Mouse
Bus 005 Device 003: ID 049f:000e Compaq Computer Corp. Internet Keyboard

How do you find out about a process? This command will perform this task. The prtstatcommand will return information about a process ID when executed.

ubuntu ~ $ prtstat 1
Process: init                   State: S (sleeping)
  CPU#:  0              TTY: 0:0        Threads: 1
Process, Group and Session IDs
  Process ID: 1           Parent ID: 0
    Group ID: 1          Session ID: 1
  T Group ID: -1
 
Page Faults
  This Process    (minor major):    60620        40
  Child Processes (minor major): 134872621      5537
CPU Times
  This Process    (user system guest blkio):   5.78   4.05   0.00   5.37
  Child processes (user system guest):       3779.73 1086.95   0.00
Memory
  Vsize:       37 MB
  RSS:         6447 kB                   RSS Limit: 18446744073709 MB
  Code Start:  0x1                       Code Stop:  0x1
  Stack Start: 0
  Stack Pointer (ESP):          0        Inst Pointer (EIP):          0
Scheduling
  Policy: normal
  Nice:   0              RT Priority: 0 (non RT)

This command will return information about the memory installed in your machine.

ubuntu ~ $ sudo lshw -class memory -short
H/W path    Device  Class      Description
==========================================
/0/0                memory     96KiB BIOS
/0/2                memory     System Memory
/0/2/0              memory     1GiB DIMM RAM
/0/2/1              memory     1GiB DIMM RAM
/0/3                memory     96KiB BIOS
/0/5                memory     System Memory
/0/6                memory
/0/7                memory

The lspci command will return useful information about your installed hardware configuration, in this case an Amazon AWS instance.

ubuntu ~ $ lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 01)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)

No comments have been made. Use this form to start the conversation :)

Leave a Reply