How to Reset USB Device Using Command Line in Linux

Resetting a USB device from the Command Line Interface (CLI) can help resolve issues such as unresponsiveness or connection problems. This guide will walk you through the steps to reset a USB device using simple commands.

Step 1: Identify the USB Device in Linux

Before resetting the USB device, you must identify it by using the lsusb command, which lists all USB devices connected to your system.

lsusb

You’ll see a list of connected USB devices, something like this:

Find USB Drive in Linux
Find a USB Drive in Linux

Note the bus and device number of the USB device you want to reset (e.g., Bus 001 Device 004).

Step 2: Unmount the USB Device in Linux

If the USB device is mounted, you need to unmount it before resetting it by using the umount command followed by the device’s mount point.

You can use the df command to see where the USB device is mounted:

df -h

Look for your USB device in the output, which will usually looks like /media/username/device_name.

Find USB Device Mount Point
Find USB Device Mount Point

Now run the command below, replacing /media/username/device_name with the actual mount point:

sudo umount /media/username/device_name

Step 3: Reset the USB Device in Linux

After unmounting the device, you can reset it using the usbreset utility. If you don’t have usbreset installed, you can install it using the following appropriate command for your specific Linux distribution.

sudo apt install usbutils         [On Debian, Ubuntu and Mint]
sudo yum install usbutils         [On RHEL/CentOS/Fedora and Rocky/AlmaLinux]
sudo emerge -a sys-apps/usbutils  [On Gentoo Linux]
sudo apk add usbutils             [On Alpine Linux]
sudo pacman -S usbutils           [On Arch Linux]
sudo zypper install usbutils      [On OpenSUSE]    
sudo pkg install usbutils         [On FreeBSD]

Once installed, you can reset the USB device using the following command by replacing Bus 001 Device 004 with your USB device’s bus and device number:

sudo usbreset /dev/bus/usb/001/004

Alternatively, you can use the following command, where <device_id> is the ID of the USB device (from the lsusb output):

sudo usbreset 090c:1000
Reset USB Device in Linux
Reset USB Device in Linux

Step 4: Remount the USB Device in Linux

After resetting the USB device, you can remount it. If your system does not automatically mount it, you can do it manually by running the following commands.

lsblk
sudo mount /dev/sdX1 /media/username/device_name

Replace /dev/sdX1 with your USB device’s identifier, which you can find using the lsblk command.

Mount USB Device in Linux
Mount USB Device in Linux

Finally, verify that the USB device is functioning properly by running the lsusb command. If it appears in the list, it is successfully reset and ready to use.

lsusb
Verify USB Device in Linux
Verify USB Device in Linux
Conclusion

Resetting a USB device from the Linux terminal is a straightforward process that can help resolve various issues. By following the steps outlined above, you can identify, unmount, reset, and remount your USB device without much hassle.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

6 Comments

Leave a Reply
  1. Dear Sir,

    In Step 2, “Unmount the USB Device in Linux,” the syntax you provide is:

    sudo umount /media/username/device_name
    

    However, how would that apply to your example? I ask because, in your example, the Device Mount Point contains a blank space.

    So, which of the following would be correct?

    sudo umount /media/ravi/Windows USB
    OR
    sudo umount /media/ravi/"Windows USB"
    

    Addendum: I think I found it! Based on Step 4, it seems the correct command might be:

    sudo umount /media/ravi/Windows\ USB/
    

    I am still unsure, especially regarding the trailing / at the end. Could you please clarify this issue, particularly when there is a blank space in the Device Mount Point?

    Regards,
    Gérard

    Reply
    • @Gerard,

      Thank you for your message and for pointing out the issue regarding the blank space in the Device Mount Point.

      You are correct to be cautious when dealing with spaces in mount points. When there is a blank space in the path, you have two valid options:

      Escape the space using a backslash (\):

      sudo umount /media/ravi/Windows\ USB
      

      Enclose the entire path in quotes:

      sudo umount "/media/ravi/Windows USB"
      

      Both options will work correctly.

      As for the trailing /, it is not strictly necessary, but including or omitting it doesn’t affect the command’s functionality in this case.

      You can leave it out:

      sudo umount /media/ravi/Windows\ USB
      

      I hope this clarifies your concern! Feel free to reach out if you have any further questions.

      Reply
  2. Maybe I am a little dense but what do you mean by “reset the USB device”?

    “can help resolve various issues”
    Such as what?

    Examples would have helped.

    Reply
    • @dragonmouth,

      By ‘resetting the USB device,’ I mean forcing the system to reinitialize the USB device, similar to unplugging it and plugging it back in without physically doing so. This can help resolve issues like the device not being recognized, errors with file transfers, or problems with power management.

      For example:

      If your USB drive isn’t being detected after plugging it in, resetting the device can make it recognizable again.
      It can fix glitches when a USB mouse or keyboard becomes unresponsive.

      Hope that helps!

      Reply
        • @Dragonmouth,

          Thank you for your question!

          If the USB device is not being detected, you can still try to identify it using the following commands:

          lsusb
          dmesg | grep -i usb
          

          Once you identify the device using these commands, you can proceed with resetting it.

          Let me know if you need further assistance!

          Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.