My Udev Notify

This is a little yet useful bash script that shows notifications when any USB device is plugged/unplugged.

Honestly, I don't quite understand why this essential feature is not implemented in major Linux distributions by default. There are notifications about removable storage, but not much more than that: e.g. no notifications about usb-to-com converters, etc. I really want to know when my devices get recognized by the system, or disconnected for whatever reason (be it a bad USB cable connection, or whatever).


Project is hosted at GitHub.

  • Clone the project somewhere;
  • Copy file ./stuff/my-udev-notify.rules to /etc/udev/rules.d
  • Modify paths in it: change “/path/to/my-udev-notify/” to real path to the script (where you cloned it).

After this, it should work for newly attached devices. That is, if you unplug some device, you won't get notification. But when you plug it back, you will. (yes, for me it works without any udev restarting. If it doesn't for you, try rebooting)

To make it work for all devices, just reboot your system. Note that there will be many notifications during first boot (see known issues below). On second boot, there will be no notifications (unless you plug in new device when system is off)


There is example configuration file:

  • ./stuff/config_example/my-udev-notify.conf

Which you can copy as /etc/my-udev-notify.conf and edit as necessary.

Known issues

  • There are notifications during first boot, and later if user plugs device when system is off. If anyone knows how can I check in bash script if system is booted already, let me know.


Enter your comment (please, English only). Wiki syntax is allowed:
   ___    _  __  ____   _   __   ____
  / _ \  / |/ / / __ \ | | / /  / __/
 / ___/ /    / / /_/ / | |/ /  _\ \  
/_/    /_/|_/  \____/  |___/  /___/
projects/my-udev-notify.txt · Last modified: 2023/03/09 08:36 by dfrank
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0