lsscsi

hardware informationLinux
The lsscsi command is one of the most frequently used commands in Linux/Unix-like operating systems. lsscsi List SCSI devices or hosts

Quick Reference

Command Name:

lsscsi

Category:

hardware information

Platform:

Linux

Basic Usage:

lsscsi [options] [arguments]

Common Use Cases

    Syntax

    lsscsi [options]

    Options

    Option Description
    -d, --device Show device node name
    -g, --generic Show generic device file name
    -c, --classic Show the device queue depth and Write Cache Enable status
    -t, --transport Show transport information where available
    -p, --protection Show protection information
    -L, --lunhex Show LUN in hexadecimal rather than decimal
    -l, --long Show the SCSI device or host name as a full path in sysfs
    -s, --size Show the size of the device
    -k, --kname Show kernel name instead of device node name
    -v, --verbose Be more verbose with output
    -H, --hosts List SCSI hosts instead of SCSI devices
    -h, --help Display help information
    -V, --version Display version information

    Examples

    How to Use These Examples

    The examples below show common ways to use the lsscsi command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.

    Basic Examples:

    lsscsi
    Display a list of all SCSI devices.
    lsscsi -s
    Show the size of SCSI devices.

    Advanced Examples:

    lsscsi -v
    Display verbose information about SCSI devices.
    lsscsi -g Show generic device file names in addition to device node names. lsscsi -d Show the device node name for each SCSI device. lsscsi -l Show the full path of the device in sysfs. lsscsi -H List SCSI hosts instead of SCSI devices. lsscsi -t Show transport information where available. lsscsi -p Show the SCSI device's protection information capabilities. lsscsi -c Show the device's queue depth and WCE (Write Cache Enable) state.

    Try It Yourself

    Practice makes perfect! The best way to learn is by trying these examples on your own system with real files.

    Understanding Syntax

    Pay attention to the syntax coloring: commands, options, and file paths are highlighted differently.

    Notes

    The 'lsscsi' command is a utility for displaying information about SCSI devices connected to a Linux system. It provides a more user-friendly and informative view of SCSI devices compared to parsing information directly from the /proc or /sys filesystems. Key features of the lsscsi command: 1. SCSI Device Enumeration: lsscsi identifies and lists all SCSI devices in the system, including hard drives, optical drives, tape drives, and other storage devices that use the SCSI protocol. 2. Device Information Display: The command shows the SCSI host, channel, target, and LUN (H:C:T:L) for each device, along with device type and vendor/model information. 3. Device Node Identification: lsscsi can show the device node names (/dev/sdX) associated with each SCSI device, helping to map logical device names to physical devices. 4. Storage Capacity Information: With the -s option, the command displays the size of storage devices, providing a quick overview of available storage capacity. 5. Transport Information: The -t option shows how each device is connected to the system (e.g., SATA, SAS, FC, iSCSI), which is useful for understanding the storage infrastructure. 6. SCSI Host Information: Using the -H option, lsscsi can display information about SCSI host adapters instead of devices, showing the host controllers in the system. 7. Detailed Device Properties: Various options allow displaying additional information like queue depth, write cache status, and protection information capabilities. It's important to note that in modern Linux systems, many devices that aren't traditionally SCSI hardware are still represented using the SCSI subsystem. This includes: - SATA hard drives and SSDs - USB storage devices - SAS (Serial Attached SCSI) devices - Fibre Channel storage - iSCSI network storage - NVMe devices (in some configurations) Common use cases for lsscsi include: - Identifying storage devices in a system - Mapping device node names (/dev/sdX) to physical devices - Checking storage device properties and capabilities - Troubleshooting storage connectivity issues - Documenting storage configuration - Scripting for automated storage management lsscsi is particularly useful in server environments with complex storage configurations, where understanding the relationship between logical device names and physical devices is crucial for proper system administration. The command is not typically installed by default on many Linux distributions but is available in standard repositories as the 'lsscsi' package.

    Related Commands

    These commands are frequently used alongside lsscsi or serve similar purposes:

    Use Cases

    Learn By Doing

    The best way to learn Linux commands is by practicing. Try out these examples in your terminal to build muscle memory and understand how the lsscsi command works in different scenarios.

    $ lsscsi
    View All Commands