Simulate udev rules for a device
Build a paste-ready command, then review its compatibility and effects before running it.
udevadm test /sys/class/block/sda 2>&1 | tail -12read-onlyno known side effects Compatibility
LinuxVerified for Linux using posix, bash, zsh syntax.
Operational knowledgereview due 2027-01-20
Requirementsudevadmudevadm must be installed and available on PATH.
Version supportudevadm Current supported releasesVerified for linux using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signalssda: /usr/lib/udev/rules.d/60-persistent-storage.rules: matchedRepresentative successful output; values vary with the selected target and system state.
Known errorsudevadm: command not foundudevadm is missing or is not available on PATH.
Verifyudevadm test /sys/class/block/sda 2>&1 | tail -12The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01udevadmCommandRuns the udevadm stage of this one-liner.
02testArgumentPasses test to udevadm.
03/sys/class/block/sdaArgumentPasses /sys/class/block/sda to udevadm.
042>&1RedirectionRedirects command input, standard output, or error output.
05|PipelinePasses the output on the left to the command on the right.
06tailCommandRuns the tail stage of this one-liner.
07-12OptionConfigures tail with the -12 option.
Example input
udevadm test /sys/class/block/sda 2>&1 | tail -12
Example output
sda: /usr/lib/udev/rules.d/60-persistent-storage.rules: matched
DEVLINKS=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0
Illustrative output — exact values vary by system and data.
Official sources