Display inotify watches and instances using dedicated inotify-info reporting application.

Clone code repository.

$ git clone https://github.com/mikesart/inotify-info
Cloning into 'inotify-info'...
remote: Enumerating objects: 87, done.
remote: Counting objects: 100% (87/87), done.
remote: Compressing objects: 100% (58/58), done.
remote: Total 87 (delta 48), reused 59 (delta 26), pack-reused 0
Receiving objects: 100% (87/87), 167.65 KiB | 1.95 MiB/s, done.
Resolving deltas: 100% (48/48), done.

Change working directory.

$ cd inotify-info

Display files.

$ ls
images  inotify-info.cpp  inotify-info.h  lfqueue  LICENSE  Makefile  README.md

Build an application.

$ make
Using gold linker...
Building _release/inotify-info...
---- inotify-info.cpp ----
---- lfqueue/lfqueue.c ----
Linking _release/inotify-info...

Install compiled binary.

$ sudo install --group root --owner root --mode 755 _release/inotify-info /usr/local/bin/

Display help information.

$ inotify-info -h
Usage: inotify-info [--threads=##] [appname | pid...]
    [-vv]
    [-?|-h|--help]

Execute application as regular user.

$ inotify-info 
------------------------------------------------------------------------------
INotify Limits:
  max_queued_events    16384
  max_user_instances   1256
  max_user_watches     131072
------------------------------------------------------------------------------
     Pid  App                        Watches   Instances
   846567 code                           21302   2
   846566 code                           13035   2
     6609 tracker-miner-fs-3             145   1
     6521 systemd (deleted)              143   4
     6958 xdg-desktop-portal-gnome        86   1
     7000 gsd-xsettings                   77   1
     7212 xdg-desktop-portal-gtk          76   1
     6919 gvfsd-trash                     73   1
     7082 snap-store                      21   1
   774633 nautilus                        18   1
     6842 gnome-shell (deleted)           15   1
     8093 update-notifier                 12   1
     7457 chrome                          11   1
     8416 gnome-terminal-server            8   1
   846311 code                             7   2
     6820 gnome-session-binary             6   2
     6946 xdg-desktop-portal               6   1
     7035 evolution-alarm-notify (deleted)   5   1
   850802 gjs-console                      4   1
    71696 @joplinapp-desktop               4   1
     6547 dbus-daemon (deleted)            4   1
   846701 code                             4   1
   846636 code                             4   1
   846499 code                             4   1
   846511 code                             4   1
   846617 code                             4   1
   846606 code                             4   1
     7576 chrome                           3   1
    71742 @joplinapp-desktop               3   1
   846375 code                             3   1
   511190 gedit                            2   1
     6994 gsd-sound                        2   1
     6971 ibus-daemon                      2   1
     6876 evolution-source-registry (deleted)   2   1
     6531 pulseaudio                       2   2
   846519 code                             1   1
     7028 ibus-portal                      1   1
    80199 VBoxSVC (deleted)                1   1
     7198 ibus-engine-simple               1   1
     7026 ibus-x11                         1   1
     7023 ibus-extension-gtk3              1   1
     7022 ibus-dconf                       1   1
     6976 gsd-housekeeping                 1   1
     6972 gsd-color                        1   1
     6899 evolution-addressbook-factory (deleted)   1   1
     6886 evolution-calendar-factory (deleted)   1   1
     6801 dbus-daemon (deleted)            1   1
     6673 goa-identity-service             1   1
     6666 goa-daemon                       1   1
     6657 gvfs-afc-volume-monitor          1   1
     6648 gvfs-udisks2-volume-monitor      1   1
     6529 pipewire-media-session           1   1
------------------------------------------------------------------------------
Total inotify Watches:   35118
Total inotify Instances: 60
------------------------------------------------------------------------------

Execute application as root user.

$ sudo inotify-info 
------------------------------------------------------------------------------
INotify Limits:
  max_queued_events    16384
  max_user_instances   1256
  max_user_watches     131072
------------------------------------------------------------------------------
     Pid  App                        Watches   Instances
   846567 code                           21302   2
   846566 code                           13035   2
        1 systemd                        268   7
     6609 tracker-miner-fs-3             145   1
     6521 systemd (deleted)              143   4
     6958 xdg-desktop-portal-gnome        86   1
     7000 gsd-xsettings                   77   1
     7212 xdg-desktop-portal-gtk          76   1
     6919 gvfsd-trash                     73   1
   2776466 udevadm                         67   1
   855209 udevadm                         67   1
     7082 snap-store                      21   1
      966 polkitd                         18   2
   774633 nautilus                        18   1
     6842 gnome-shell (deleted)           15   1
     1014 python3.10 (deleted)            13   1
     8093 update-notifier                 12   1
     7457 chrome                          11   1
     8416 gnome-terminal-server            8   1
   846311 code                             7   2
     1134 NetworkManager                   6   2
     6946 xdg-desktop-portal               6   1
     6820 gnome-session-binary             6   2
     7035 evolution-alarm-notify (deleted)   5   1
   846499 code                             4   1
   846511 code                             4   1
    71696 @joplinapp-desktop               4   1
      948 dbus-daemon (deleted)            4   1
   846606 code                             4   1
   846617 code                             4   1
   846636 code                             4   1
   846701 code                             4   1
   850802 gjs-console                      4   1
     1674 colord                           4   1
     6547 dbus-daemon (deleted)            4   1
      943 accounts-daemon                  3   1
     2588 packagekitd                      3   1
   846375 code                             3   1
    71742 @joplinapp-desktop               3   1
     7576 chrome                           3   1
      979 udisksd                          3   2
   511190 gedit                            2   1
     6531 pulseaudio                       2   2
      946 avahi-daemon                     2   1
     6876 evolution-source-registry (deleted)   2   1
     6994 gsd-sound                        2   1
     6971 ibus-daemon                      2   1
     6666 goa-daemon                       1   1
   2776422 systemd-timesyncd                1   1
   2776259 systemd-resolved                 1   1
      944 acpid                            1   1
     1659 containerd                       1   1
      967 power-profiles-daemon            1   1
     6529 pipewire-media-session           1   1
     7022 ibus-dconf                       1   1
     7023 ibus-extension-gtk3              1   1
     7026 ibus-x11                         1   1
     6648 gvfs-udisks2-volume-monitor      1   1
   846519 code                             1   1
     6657 gvfs-afc-volume-monitor          1   1
      976 systemd-logind (deleted)         1   1
     7028 ibus-portal                      1   1
     6673 goa-identity-service             1   1
     6801 dbus-daemon (deleted)            1   1
   619332 containerd-shim-runc-v2          1   1
   619197 containerd-shim-runc-v2          1   1
     6976 gsd-housekeeping                 1   1
    80722 VBoxHeadless (deleted)           1   1
    80199 VBoxSVC (deleted)                1   1
     6972 gsd-color                        1   1
     6886 evolution-calendar-factory (deleted)   1   1
     6899 evolution-addressbook-factory (deleted)   1   1
     7198 ibus-engine-simple               1   1
------------------------------------------------------------------------------
Total inotify Watches:   35585
Total inotify Instances: 90
------------------------------------------------------------------------------

Execute application as regular user to inspect specific process.

 inotify-info nautilus
------------------------------------------------------------------------------
INotify Limits:
  max_queued_events    16384
  max_user_instances   1256
  max_user_watches     131072
------------------------------------------------------------------------------
     Pid  App                        Watches   Instances
   846567 code                           21302   2
   846566 code                           13035   2
     6609 tracker-miner-fs-3             145   1
     6521 systemd (deleted)              143   4
     6958 xdg-desktop-portal-gnome        86   1
     7000 gsd-xsettings                   77   1
     7212 xdg-desktop-portal-gtk          76   1
     6919 gvfsd-trash                     73   1
     7082 snap-store                      21   1
   774633 nautilus                        18   1
[259.2]: 23330923 26869837 23199793 8790558 23199745 27399688 30277764 6031642 6165031 6160541 23199752 23199867 23199809 23199746 6031714 23199871 23199813 6031609
     6842 gnome-shell (deleted)           15   1
     8093 update-notifier                 12   1
     7457 chrome                          11   1
     8416 gnome-terminal-server            8   1
   846311 code                             7   2
     6820 gnome-session-binary             6   2
     6946 xdg-desktop-portal               6   1
     7035 evolution-alarm-notify (deleted)   5   1
   850802 gjs-console                      4   1
    71696 @joplinapp-desktop               4   1
     6547 dbus-daemon (deleted)            4   1
   846701 code                             4   1
   846636 code                             4   1
   846499 code                             4   1
   846511 code                             4   1
   846617 code                             4   1
   846606 code                             4   1
     7576 chrome                           3   1
    71742 @joplinapp-desktop               3   1
   846375 code                             3   1
   511190 gedit                            2   1
     6994 gsd-sound                        2   1
     6971 ibus-daemon                      2   1
     6876 evolution-source-registry (deleted)   2   1
     6531 pulseaudio                       2   2
   846519 code                             1   1
     7028 ibus-portal                      1   1
    80199 VBoxSVC (deleted)                1   1
     7198 ibus-engine-simple               1   1
     7026 ibus-x11                         1   1
     7023 ibus-extension-gtk3              1   1
     7022 ibus-dconf                       1   1
     6976 gsd-housekeeping                 1   1
     6972 gsd-color                        1   1
     6899 evolution-addressbook-factory (deleted)   1   1
     6886 evolution-calendar-factory (deleted)   1   1
     6801 dbus-daemon (deleted)            1   1
     6673 goa-identity-service             1   1
     6666 goa-daemon                       1   1
     6657 gvfs-afc-volume-monitor          1   1
     6648 gvfs-udisks2-volume-monitor      1   1
     6529 pipewire-media-session           1   1
------------------------------------------------------------------------------
Total inotify Watches:   35118
Total inotify Instances: 60
------------------------------------------------------------------------------

Searching ';/'; for listed inodes... (8 threads)
  6031609 [259:2] /usr/local/share/
  6031642 [259:2] /usr/share/applications/
  6031714 [259:2] /usr/share/gnome/
  6160541 [259:2] /usr/share/thumbnailers/
  6165031 [259:2] /usr/share/ubuntu/applications/
  8790558 [259:2] /var/lib/snapd/desktop/applications/
 23199745 [259:2] /home/
 23199746 [259:2] /home/milosz/
 23199752 [259:2] /home/milosz/.config/
 23199793 [259:2] /home/milosz/.local/share/
 23199809 [259:2] /home/milosz/Szablony/
 23199813 [259:2] /home/milosz/Obrazy/
 23199867 [259:2] /home/milosz/.local/share/applications/
 23199871 [259:2] /home/milosz/.config/gtk-3.0/
 23330923 [259:2] /home/milosz/.local/share/nautilus/scripts/
 26869837 [259:2] /home/milosz/Obrazy/Zrzuty ekranu/
 27399688 [259:2] /home/milosz/Obrazy/Zrzuty ekranu/obsidian/
 30277764 [259:2] /etc/xdg/

502 854 dirs scanned (1,33 seconds)