Is there any way to detect when a usb flash drive/stick/etc gets plugged in a usb port? To be more specific, I need to have a way to detect usb insertion/removal and use this information in a python script. I'm posting here because I am working in the elementary OS. If I'm posting in the wrong stackexchange forum feel free to move it accordingly. Thank you for your time.

1 Answer 1


In modern Linux kernels, you can use udev to detect removable disks. You can read about udev at:

Ubuntu Manpages

I'm not a Python expert, but i have find a module about using udev, so you can try with it:

Pure Python udev bindings

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.