gvfs-monitor-dir
Monitor directory changes
SYNOPSIS
gvfs-monitor-dir [OPTION...] LOCATION
PARAMETERS
-h, --help
Show help usage.
-v, --verbose
Print detailed information on startup, including initial directory listing.
DESCRIPTION
gvfs-monitor-dir is a command-line utility from the GVFS (GNOME Virtual File System) package used to monitor directories for changes across local and remote filesystems. It takes a GVFS URI as input, such as file:///tmp for local directories or smb://server/share for remote shares.
When monitoring starts, it outputs events to stdout in the format EVENT filename, where EVENT is one of: CREATE (file created), DELETE (file deleted), CHANGED (file content changed), ATTRIB (attributes changed), or CHANGES_DONE_HINT (batch changes complete). For local file:// URIs, it leverages the inotify(7) kernel interface for efficiency. Remote backends like FTP, SFTP, or SMB use backend-specific polling or notifications if supported.
This tool is ideal for shell scripts, daemons, or automation that need to react to filesystem events without polling. It runs indefinitely until interrupted (e.g., Ctrl+C) and requires the GVFS daemon (gvfsd) to be active.
CAVEATS
Runs indefinitely until SIGINT (Ctrl+C); requires GVFS daemon; remote backends may poll inefficiently if no native events; output is line-buffered to stdout.
EVENTS
CREATE filename - New file/dir created.
DELETE filename - File/dir deleted.
CHANGED filename - Content modified.
ATTRIB filename - Metadata changed.
CHANGES_DONE_HINT - End of batch operations.
EXAMPLES
gvfs-monitor-dir file:///tmp - Monitor local /tmp.
gvfs-monitor-dir smb://myserver/public - Monitor SMB share.
gvfs-monitor-dir -v sftp://user@host/home - Verbose SFTP monitor.
HISTORY
Part of GVFS since GNOME 2.15 (2007); evolved with GVFS backends for better remote support in GNOME 3+; now in gvfs-utils package.
SEE ALSO
inotifywait(1), gvfs-ls(1), gio(1), inotify(7)


