Forrest logo
back to the badblocks tool

badblocks:tldr:6cb2f

badblocks: Search a disk for bad blocks by using a non-destructive read-only test.
$ sudo badblocks ${-dev-sdX}
try on your machine

The command "sudo badblocks ${-dev-sdX}" is used to run the badblocks utility with root permissions (through the "sudo" command) on a specific storage device. Here's a breakdown of the command components:

  • "sudo": This is a command used in Unix-like systems to execute a command with superuser privileges. It allows you to perform administrative tasks that require root access.

  • "badblocks": This is a command-line utility in Linux used to scan and identify bad blocks on a storage device such as a hard disk or solid-state drive (SSD). Bad blocks are damaged or malfunctioning sectors on the disk that may indicate impending disk failure.

  • "${-dev-sdX}": This part of the command is called a variable. In this case, it represents a specific storage device to be scanned. The placeholder "sdX" is replaced with the name of the desired storage device, such as "sda" or "sdb". The "-dev-" prefix is used to specify that it is a device.

Putting it all together, the command "sudo badblocks ${-dev-sdX}" runs the badblocks utility with root privileges to scan and identify bad blocks on the specified storage device.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the badblocks tool