Linux 101 : Linux device manager "udev" amd "udevadm"

The device manager udev handles the settings and the detection of hardware devices. 
It is a part of "systemd", it also load the drivers for pluggable devices. 

The "udev" uses rules that are defined
 in the "/etc/udev/rules.d/", and we can put our configuration files for the devices there.
The files are named  "xx-name.rules", "xx" being a number that determines the order in which these files are run.

Below are the different udev rules files:

  • "/etc/udev/rules.d" : used for local administration of udev
  • "/usr/lib/udev/rules.d" : contains system-generated udev rules. 
  • "/run/udev/rules.d" : runtime rules that don't last beyond a reboot are placed in that directory.

Rules in "/etc/udev/rules.d/" override the rules in the "usr/lib/udev/rules.d/" directory.

To manage "udev" we could use the "udevadm" command. Below are some example of this command:

The above command gets the device information from the udev database and the "/sys/" filesystem.

To change the state of udev we use the following:


The above command forces udev to re-read its configuration from newly added rule files.

The below command runs the rules that apply to any device that is plugged in: 

We can also use the "-c" option with the "trigger" command to launch an event when a certain "action" is performed, like "add", when the device is added, "remove", when it is removed.

Below is the general command, we will need to replace "action" with one of the examples - add, remove, ... -, mentioned before:

To monitor the udev events, we use the below command:

We can for example get information about the "/dev/sda1" device using the below command:


Leave as a comment: