Linux "udevadm" Command Line Options and Examples
udev management tool

udevadm expects a command and command specific options. It controls the runtime behavior of systemd-udevd, requests kernel events, manages the event queue, and provides simple debugging mechanisms..


Usage:

udevadm [--debug] [--version] [--help]






Command Line Options:

-d
Print debug messages to standard error.
udevadm -d ...
--version
Print a short version string and exit.
udevadm --version ...
-h
Print a short help text and exit.udevadm info [options] [devpath|file]Queries the udev database for device information stored in the udev database. It can also query the propertiesof a device from its sysfs representation to help creating udev rules that match this device.
udevadm -h ...
-q
Query the database for the specified type of device data. It needs the --path or --name to identify thespecified device. Valid TYPEs are: name, symlink, path, property, all.
udevadm -q ...
-p
The /sys path of the device to query, e.g. [/sys]/class/block/sda. Note that this option usually is notvery useful, since udev can guess the type of the argument, so udevadm --devpath=/class/block/sda isequivalent to udevadm /sys/class/block/sda.
udevadm -p ...
-n
The name of the device node or a symlink to query, e.g. [/dev]/sda. Note that this option usually is notvery useful, since udev can guess the type of the argument, so udevadm --name=sda is equivalent to udevadm/dev/sda.
udevadm -n ...
-r
Print absolute paths in name or symlink query.
udevadm -r ...
-a
Print all sysfs properties of the specified device that can be used in udev rules to match the specifieddevice. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules.
udevadm -a ...
-x
Print output as key/value pairs. Values are enclosed in single quotes.
udevadm -x ...
-P
Add a prefix to the key name of exported values.
udevadm -P ...
-e
Export the content of the udev database.
udevadm -e ...
-c
Cleanup the udev database.
udevadm -c ...
-v
Print the list of devices which will be triggered.
udevadm -v ...
-t
Trigger a specific type of devices. Valid types are: devices, subsystems. The default value is devices.
udevadm -t ...
-s
Trigger events for devices which belong to a matching subsystem. This option can be specified multipletimes and supports shell style pattern matching.
udevadm -s ...
-S
Do not trigger events for devices which belong to a matching subsystem. This option can be specifiedmultiple times and supports shell style pattern matching.
udevadm -S ...
-A
Do not trigger events for devices with a matching sysfs attribute. If a value is specified along with theattribute name, the content of the attribute is matched against the given value using shell style patternmatching. If no value is specified, the existence of the sysfs attribute is checked. This option can bespecified multiple times.
udevadm -A ...
-g
Trigger events for devices with a matching tag. This option can be specified multiple times.
udevadm -g ...
-y
Trigger events for devices for which the last component (i.e. the filename) of the /sys path matches thespecified PATH. This option can be specified multiple times and also supports shell style patternmatching.
udevadm -y ...
--name-match
Trigger events for devices with a matching device path. This option can be specified multiple times.
udevadm --name-match ...
-b
Trigger events for all children of a given device.
udevadm -b ...
-E
Stop waiting if file exists.
udevadm -E ...
-l
Set the internal log level of systemd-udevd. Valid values are the numerical syslog priorities or theirtextual representations: emerg, alert, crit, err, warning, notice, info, and debug.
udevadm -l ...
-R
Signal systemd-udevd to reload the rules files and other databases like the kernel module index. Reloadingrules and databases does not apply any changes to already existing devices; the new configuration willonly be applied to new events.
udevadm -R ...
-m
Set the maximum number of events, systemd-udevd will handle at the same time.
udevadm -m ...
-k
Print the kernel uevents.
udevadm -k ...
-u
Print the udev event after the rule processing.
udevadm -u ...
-N
Specify when udevadm should resolve names of users and groups. When set to early (the default), names willbe resolved when the rules are parsed. When set to late, names will be resolved for every event. When setto never, names will never be resolved and all devices will be owned by root.
udevadm -N ...