Forrest logo
tool overview
On this page you find all important commands for the CLI tool fswatch. If the command you are looking for is missing please ask our AI.

fswatch

fswatch is a command line tool used for monitoring changes in a directory or file system. It is primarily used to keep track of file changes, additions, or removals in real-time. With fswatch, users can specify the directory or file they want to monitor, and it will continuously watch for any modifications made within that location. The tool supports various platforms like macOS, Linux, and Windows. fswatch is written in C++, making it highly efficient and reliable for monitoring file system events. It uses native event mechanisms like FSEvents on macOS, inotify on Linux, and ReadDirectoryChangesW on Windows to ensure accurate and efficient monitoring. The monitored events can be customized and filtered based on file types, attributes, or patterns, allowing users to focus only on specific changes relevant to their needs. fswatch can be used for a wide range of applications such as automating build processes, triggering actions when certain files are modified, or even for basic file system monitoring and auditing purposes. It provides detailed output and logging information to keep users informed about the changes being detected. Given its simplicity, flexibility, and cross-platform compatibility, fswatch has gained popularity among developers and system administrators as a reliable file system monitoring tool.

List of commands for fswatch:

  • fswatch:tldr:6dca5 fswatch: Watch one or more files and/or directories.
    $ fswatch ${filename} ${path-to-directory} ${path-to-another_directory-**-*-js} | xargs -n 1 ${bash_command}
    try on your machine
    explain this command
  • fswatch:tldr:d1ad2 fswatch: Filter by event type.
    $ fswatch --event ${select} ${path-to-directory} | xargs -n 1 ${bash_command}
    try on your machine
    explain this command
  • fswatch:tldr:d75fd fswatch: Print the absolute paths of the changed files.
    $ fswatch ${path-to-directory} | xargs -n 1 -I {} echo {}
    try on your machine
    explain this command
  • fswatch:tldr:f52ce fswatch: Run a Bash command on file creation, update or deletion.
    $ fswatch ${filename} | xargs -n 1 ${bash_command}
    try on your machine
    explain this command
tool overview