• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

udevadm Command Examples in Linux

by admin

The udevadm command is used to manage udev. It takes various subcommands, each of which performs a certain task to modify the behavior of the systemd-udevd daemon and related components. Some of these subcommands are described in the following table.

Subcommand Used To
info Retrieve device information stored in the udev database, as well as detailed device attributes from the /sys/ filesystem. For example, you can view a device’s vendor ID, product ID, serial number, and much more.
control Modify the running state of udev. For example, providing the –reload-rules option will ensure that udev is reading from any new rules files you’ve added.
trigger Execute rules that apply to any device that is currently plugged in. You can also specify an action using the -c option, such as add, remove, or change. As the names imply, these will trigger events where a device is added, removed, or changed in the running kernel.
monitor Watch for events sent by the kernel or by a udev rule.
test Simulate a udev event running for a device, with results on output.

With the udevadm monitor command, you can tap into udev in real time and see what it sees when you plug in different devices. Try it as root.

# udevadm monitor

The monitor function prints received events for

  • UDEV: The event which udev sends out after rule processing.
  • KERNEL: The kernel uevent.

With udevadm monitor running, plug in a thumb drive and watch as all kinds of information are spewed out onto your screen. Notice, particularly, that the type of event is an ADD event. That’s a good way of identifying what type of event you want.

Syntax

The syntax of the udevadm command is:

# udevadm [options] [subcommand] [arguments]

udevadm Command Examples

1. Monitor all device events:

# udevadm monitor

2. Print `uevents` sent out by the kernel:

# udevadm monitor --kernel

3. Print device events after being processed by `udev`:

# udevadm monitor --udev

4. List attributes of a device:

# udevadm info --attribute-walk --path /dev/sda1

5. Reload all `udev` rules:

# udevadm control --reload-rules

6. Trigger all `udev` rules to run:

# udevadm trigger

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to enable/disable wayland on Ubuntu 22.04
  2. hdparm: command not found
  3. esearch: command not found
  4. qm snapshot Command Examples in Linux
  5. How to Compress and Decompress .bz2 files in Linux Using bzip2 Command
  6. convmv: Convert filenames (NOT file content) from one encoding to another
  7. nft: command not found
  8. dget Command Examples in Linux
  9. pacstrap: command not found
  10. gh extension: Manage extensions for the GitHub CLI

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright