Tutorial on how to write basic udev rules in Linux - LinuxConfig.org

In a GNU/Linux system, while devices low level support is handled at the kernel level, the management of events related to them is managed in userspace by udev, and more precisely by the udevd daemon. Learning how to write rules to be applied on the occurring of those events can be really useful to modify the behavior of the system and adapt it to our needs.
This is a companion discussion topic for the original entry at https://linuxconfig.org/tutorial-on-how-to-write-basic-udev-rules-in-linux


Nice tutorial.

Egidio Docile -> SOmeDumbBumb


Thanks! Good tutorial

Does the rule name need to start with a number prefix? If the rule does not contain a number prefix i.e. “logitech.rules” would it start?

Hi Nabilishes,

Welcome to our forums.

The number prefix is a common convention to ensure the right load order of rules (or other configuration files, for that matter). Many services and applications read configuration files in alphabetical order, so 01-xy.rules will load before 22-abc.rules. 99-something.rules will be the last one to be loaded. If you don’t use numbers as prefix, it simply means you don’t follow the convention, but the rule will be loaded anyway - after the number-prefixed rules files. For example, your “logitech.rules” will load after a “99-some.rules”, and before a “past.rules” file. Numbers are used to make it easier to determine the loading order.