commands.sh

sg_raw

all

Send arbitrary SCSI command to a connected device.

More info →

Options (7)

-i, --infileboolean

Read data from `IFILE` instead of `stdin`

Example: sg_raw {{[-i|--infile]}} {{path/to/IFILE}} {{/dev/sgX}} {{SCSI_command}}
-k, --skipboolean

Skip the first `LEN` bytes of input data

Example: sg_raw {{[-k|--skip]}} {{LEN}} {{/dev/sgX}} {{SCSI_command}}
-s, --sendboolean

Read `SLEN` bytes of data and send to the device

Example: sg_raw {{[-s|--send]}} {{SLEN}} {{/dev/sgX}} {{SCSI_command}}
-t, --timeoutboolean

Wait up to `SEC` seconds for `sg_raw` to finish processing

Example: sg_raw {{[-t|--timeout]}} {{SEC}} {{/dev/sgX}} {{SCSI_command}}
-v, --verboseboolean

Increase verbosity level by 1

Example: sg_raw {{[-v|--verbose]}} {{/dev/sgX}} {{SCSI_command}}
-b, --binaryboolean

Dump returned data in binary form

Example: sg_raw {{[-b|--binary]}} {{/dev/sgX}} {{SCSI_command}}
-o, --outfileboolean

Write data received from the specified device to an `OFILE`

Example: sg_raw {{[-o|--outfile]}} {{path/to/OFILE}} {{/dev/sgX}} {{SCSI_command}}

Examples (8)

Send a command to an optical SCSI device assigned to `sr0` to load the media in its tray

sg_raw /dev/sr0 EA 00 00 00 00 01

Read data from `IFILE` instead of `stdin`

sg_raw [-i|--infile] path/to/IFILE /dev/sgX SCSI_command

Skip the first `LEN` bytes of input data

sg_raw [-k|--skip] LEN /dev/sgX SCSI_command

Read `SLEN` bytes of data and send to the device

sg_raw [-s|--send] SLEN /dev/sgX SCSI_command

Wait up to `SEC` seconds for `sg_raw` to finish processing

sg_raw [-t|--timeout] SEC /dev/sgX SCSI_command

Increase verbosity level by 1

sg_raw [-v|--verbose] /dev/sgX SCSI_command

Dump returned data in binary form

sg_raw [-b|--binary] /dev/sgX SCSI_command

Write data received from the specified device to an `OFILE`

sg_raw [-o|--outfile] path/to/OFILE /dev/sgX SCSI_command
made by @shridhargupta | data from tldr-pages