How To Fix: lsusb command Not Found Error

Introduction

When working with Linux systems, you may encounter various command-line tools to interact with hardware and software. One such useful tool is the lsusb command, which allows users to view connected USB devices. However, there might be instances where you encounter an error stating that the lsusb command is not found. This can be frustrating, especially when you rely on this command for various tasks. In this article, we will explore the reasons behind this error and provide step-by-step solutions to fix it.

What is the lsusb command?

The lsusb command is a powerful utility in Linux-based systems that lists all the connected USB devices. It provides detailed information about the USB buses, hubs, and devices, allowing users to diagnose and troubleshoot USB-related problems efficiently.

Reasons for the “lsusb Command Not Found” error

Outdated or missing packages

One of the primary reasons for encountering the “lsusb command not found” error is the absence or outdated state of the required packages. When the necessary packages for lsusb are not installed, the system cannot recognize the command.

Incorrect PATH variable

The PATH variable in a Linux system defines the directories where the operating system searches for executable files. If the location of the lsusb command is not included in the PATH variable, the system will be unable to locate and execute the command.

Verifying the existence of lsusb

Before diving into the solutions, it’s essential to verify if the lsusb command exists on your system. Open the terminal and enter the following command:

lsusb

If the command is available, it will display a list of connected USB devices. If you encounter an error, proceed with the solutions below.

Solution 1: Install/update necessary packages

To resolve the “lsusb command not found” error, you need to ensure that the required packages are installed and up-to-date. You can do this by using the package manager that corresponds to your Linux distribution.

For example, on Debian/Ubuntu-based systems, you can use the following command:

sudo apt-get update
sudo apt-get install usbutils

If you are using a Fedora/CentOS system, use:

sudo dnf install usbutils

Once the installation is complete, try running the lsusb command again to see if the error persists.

Solution 2: Correct the PATH variable

If the lsusb package is installed, but you still encounter the error, it might be due to the PATH variable. You can explicitly specify the location of the lsusb command by modifying the PATH variable.

Open the terminal and enter:

echo 'export PATH=$PATH:/usr/sbin' >> ~/.bashrc
source ~/.bashrc

After executing the commands, try running lsusb again to check if the issue is resolved.

Checking for hardware issues

If the above solutions do not fix the “lsusb command not found” error, there might be a hardware-related problem. Ensure that your USB devices are properly connected, and there are no physical issues with the USB ports.

Conclusion

Encountering the “lsusb command not found” error in Linux can be frustrating, but with the right troubleshooting steps, you can quickly resolve it. In this article, we discussed the reasons for this error and provided two effective solutions. By installing the necessary packages and correcting the PATH variable, you should be able to use the lsusb command seamlessly.

FAQs

Q1: Can I use lsusb on non-Linux systems?

No, lsusb is specific to Linux-based systems and cannot be used on other operating systems like Windows or macOS.

Q2: Does lsusb require root privileges to run?

Yes, the lsusb command requires root or superuser privileges to access and display detailed information about connected USB devices.

Q3: Can I use lsusb to interact with USB storage devices?

Yes, lsusb can detect and display information about USB storage devices like external hard drives and USB flash drives.

Leave a Comment