inotifywatch(1)

πŸ’… inotifywatch(1) + fsnotifywatch(1) β€” General Commands Manual, but make it make sense ✨

okay so this is the inotifywatch(1) / fsnotifywatch(1) page from General Commands Manual, and it is lowkey iconic for anyone who wants filesystem event receipts. no cap.

🌸 NAME

inotifywatch, fsnotifywatch β€” gather filesystem access statistics using inotify or fanotify.

πŸ¦‹ SYNOPSIS

inotifywatch [-hvzrPqfIFS] [-e <event> ] [-t <seconds> ] [-a <event> ]
       [-d <event> ] <file> [ ... ]

fsnotifywatch [-hvzrPqfIFS] [-e <event> ] [-t <seconds> ] [-a <event> ]
       [-d <event> ] <file> [ ... ]

🌈 DESCRIPTION

inotifywatch listens for filesystem events using Linux's inotify(7) interface by default, then outputs a summary count of the events received on each file or directory. it's giving "bestie is taking notes on every little filesystem moment" πŸ’…

fsnotifywatch is similar to inotifywatch but it is using Linux's fanotify(7) interface by default. If explicitly specified, it uses the inotify(7) interface. periodt.

πŸŽ€ OUTPUT

inotifywatch and fsnotifywatch will output a table on standard out with one column for each type of event and one row for each watched file or directory. the table will show the amount of times each event occurred for each watched file or directory. output can be sorted by a particular event using the -a or -d options. ✨

some diagnostic information will be output on standard error. that's the little side-commentary, bestie 🫢

✨ OPTIONS ✨

  • -h, --help β€” output some helpful usage information. the "help me help you" option πŸ’–
  • -v, --verbose β€” output some extra information on standard error during execution. it's the "tell me everything" vibe.
  • @<file> β€” when watching a directory tree recursively, exclude the specified file from being watched. the file must be specified with a relative or absolute path according to whether a relative or absolute path is given for watched directories. if a specific path is explicitly both included and excluded, it will always be watched.

Note: if you need to watch a directory or file whose name starts with @, give the absolute path. iykyk πŸ™ˆ

  • --fromfile <file> β€” read filenames to watch or exclude from a file, one filename per line. if filenames begin with @ they are excluded as described above. if <file> is -, filenames are read from standard input. use this option if you need to watch too many files to pass in as command line arguments. truly the "i have 5000 files and a dream" option πŸ¦‹
  • -z, --zero β€” output table rows and columns even if all elements are zero. by default, rows and columns are only output if they contain non-zero elements. using this option when watching for every event on a lot of files can result in a lot of output! like, a lot a lot 😭
  • --exclude <pattern> β€” do not process any events for the subset of files whose filenames match the specified POSIX regular expression, case sensitive.
  • --excludei <pattern> β€” do not process any events for the subset of files whose filenames match the specified POSIX regular expression, case insensitive.
  • --include <pattern> β€” process events only for the subset of files whose filenames match the specified POSIX regular expression, case sensitive.
  • --includei <pattern> β€” process events only for the subset of files whose filenames match the specified POSIX regular expression, case insensitive.
  • -r, --recursive β€” watch all subdirectories of any directories passed as arguments. watches will be set up recursively to an unlimited depth. symbolic links are not traversed. if new directories are created within watched directories they will automatically be watched.

Warning: if you use this option while watching the root directory of a large tree, it may take quite a while until all inotify watches are established, and events will not be received in this time. also, since one inotify watch will be established per subdirectory, it is possible that the maximum amount of inotify watches per user will be reached. the default maximum is 8192; it can be increased by writing to /proc/sys/fs/inotify/max_user_watches. bestie, root-directory recursive watching is not for the faint of heart πŸ’€

  • -P, --no-dereference β€” do not follow symlinks. simple. clean. no symlink shenanigans.
  • -t <seconds>, --timeout <seconds> β€” listen only for the specified amount of seconds. if not specified, inotifywatch will gather statistics until receiving an interrupt signal by (for example) pressing CONTROL-C at the console. so you can let it cook until you say stop πŸ“
  • -e <event>, --event <event> β€” listen for specific event(s) only. the events which can be listened for are listed in the EVENTS section. this option can be specified more than once. if omitted, all events are listened for.
  • -a <event>, --ascending <event> β€” sort output ascending by event counts for the specified event. sortable events include total and all the events listed in the EVENTS section except move and close (you must use moved_to, moved_from, close_write or close_nowrite instead). the default is to sort descending by total.
  • -d <event>, --descending <event> β€” sort output descending by event counts for the specified event. sortable events include total and all the events listed in the EVENTS section except move and close (you must use moved_to, moved_from, close_write or close_nowrite instead). the default is to sort descending by total.
  • -I, --inotify β€” watch using inotify (default for inotifywatch). the classic. the main character. πŸ‘‘
  • -F, --fanotify β€” watch using fanotify (default for fsnotifywatch). fanotify support for reporting events with inotify compatible information was added in kernel v5.9. with older kernels the command will fail. as of kernel v5.12, fanotify requires admin privileges. so check your kernel and your privileges, bestie β€” this is not a drill 🚨
  • -S, --filesystem β€” watch entire filesystem of any directories passed as arguments using fanotify. it's giving "whole filesystem, no crumbs" 🌈
  • -M, --mount β€” watch entire mount of any directories passed as arguments using fanotify. not just a folder, the whole mount vibe πŸ’œ

🌈 SEE ALSO 🫢

okay so like, if you want the other half of the inotify experience β€” the one where you actually watch stuff happen live instead of counting it all up afterwards β€” go read:

  • inotifywait(1) β€” the sister tool fr fr, it just sits there and waits for events to happen and tells you the second they do πŸ’–
  • inotify(7) β€” the big one, the lore, the actual kernel interface behind all this πŸ‘‘ read it if you wanna know what's really going on under the hood, no cap

and that's the whole page bestie!! πŸ¦‹βœ¨ this is inotifywatch from version 4.26.0, dated 2026-10-07 β€” go forth and count your events, you're literally gonna slay πŸ’…πŸŽ€

πŸ“¦ where this page comes from