Skip to main content
Engineering LibreTexts

09-C.3: Monitoring Devices in Linux

  • Page ID
    40078
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    EXAM OBJECTIVES COVERED
    2.7 Explain the use and operation of Linux devices.

    The lsdev Command

    lsdev gathers information about your computer's installed hardware from the /proc/interrupts, /proc/ioports and /proc/dma files, giving you a quick overview of which hardware uses what I/O addresses and what IRQ and DMA channels.

    The information used by the lsdev command is found in the the following files:

    • /proc/interrupts — Each logical CPU core and its associated interrupt requests (IRQ) is listed in this file. A device will send an interrupt to the processor to inform the processor that the hardware needs to perform some task. The file lists how many signals were sent to each CPU core through one of the many IRQ addresses in the system. The name of the hardware device that is mapped to each IRQ address is also listed.
    • /proc/ioports —This file provides a list of currently registered port regions used for input or output communication with a device.
    • /proc/dma —This file contains a list of the registered ISA DMA channels in use.

    This video covers the use of some of the 'ls' type of commands.

    The lsusb Command

    The lsusb command in Linux is used to display the information about USB buses and the devices connected to them. The properties displayed are speed, BUS, class, type details, etc. This information is gathered by scanning the /dev/bus/usb for information about the connected device, the device id, and vendor information.

    Syntax:

    lsusb [ OPTIONS ] - probably the most used option is -V which provides a very verbose output for each device.

    Command Options:

    Options Meaning
    -v, --verbose Tells lsusb to be verbose and display detailed information about the devices shown. This includes configuration descriptors for the device's current speed. Class descriptors will be shown, when available, for USB device classes including hub, audio, HID, communications, and chipcard
    -s [[bus]:][devnum] Show only devices in specified bus and/or devnum. Both ID's are given in decimal and may be omitted.
    -d [vendor]:[product] Show only devices with the specified vendor and product ID. Both ID's are given in hexadecimal
    -D device Do not scan the /dev/bus/usb directory, instead display only information about the device whose device file is given. The device file should be something like /dev/bus/usb/001/001
    -t Tells lsusb to dump the physical USB device hierarchy as a tree. This overrides the v option.
    -V, --version Print version information on standard output, then exit successfully.

    Example:

    pbmac@pbmac-server $ lsusb
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 008 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 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 004 Device 004: ID 046d:c52b Logitech, Inc. Unifying Receiver
    Bus 004 Device 003: ID 413c:2006 Dell Computer Corp. 
    Bus 004 Device 002: ID 413c:1004 Dell Computer Corp. 
    |------|              |--------| |------------------|
    Bus number            Device ID   Vendor and product info

    The lspci Command

    The lspci command on Linux systems is a utility for displaying information about PCI buses in the system and devices connected to them. By default, it shows a brief list of devices. Use the options described below to request either a more verbose output or output intended for parsing by other programs.

    Syntax:

    lspci [ OPTIONS ]

    Command Options:

    Option Meaning
    -m Dump PCI device data in a backward-compatible machine readable form. See below for details.
    -mm Dump PCI device data in a machine readable form for easy parsing by scripts. See the man page for details.
    -t Show a tree-like diagram containing all buses, bridges, devices and connections between them.

    Example:

    pbmac@pbmac-server $ lspci
    00:00.0 Host bridge: Intel Corporation 4 Series Chipset DRAM Controller (rev 03)
    00:01.0 PCI bridge: Intel Corporation 4 Series Chipset PCI Express Root Port (rev 03)
    00:19.0 Ethernet controller: Intel Corporation 82567LM-3 Gigabit Network Connection (rev 02)
    00:1d.7 USB controller: Intel Corporation 82801JD/DO (ICH10 Family) USB2 EHCI Controller #1 (rev 02)
    00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev a2)
    00:1f.2 RAID bus controller: Intel Corporation SATA Controller [RAID mode] (rev 02)
    00:1f.3 SMBus: Intel Corporation 82801JD/DO (ICH10 Family) SMBus Controller (rev 02)
    01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] RV620 LE [Radeon HD 3450]
    

    The lpq Command

    The lpq command shows the current print queue status on the named printer. Jobs queued on the default destination will be shown if no printer or class is specified on the command-line. The +interval option allows you to continuously report the jobs in the queue until the queue is empty; the list of jobs is shown once every interval seconds.

    Syntax:

    lpq [ OPTIONS ]

    Command Options:

    Options Meaning
    -E Forces encryption when connecting to the server.
    -P destination[/instance] Specifies an alternate printer or class name.
    -U username Specifies an alternate username.
    -a Reports jobs on all printers.
    -h server[:port] Specifies an alternate server.
    -l Requests a more verbose (long) reporting format.

    Example:

    pbmac@pbmac-server $ lpq  
    printer is ready and printing  
    Rank    Owner   Job     File(s)                         Total Size  
    active  patm    603     (stdin)

    Adapted from:
    "lspci" by Multiple ContributorsWikipedia is licensed under CC BY-SA 3.0
    "lsusb command in Linux with Examples" by basilmohamed, Geeks for Geeks is licensed under CC BY-SA 4.0


    09-C.3: Monitoring Devices in Linux is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?