Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

Watcherd Shell Listener for Directory Changes in Linux

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Watcherd is a tool for Linux that helps to monitor directory changes and print whatever changes are done like adding and deleting for a particular directory and execute commands and shell scripts according to a particular event. 

Installing Watcherd on Linux

Step 1: Downloading watcherd.

Since watcherd is a Github repository you can use wget command to download its zip and extract it. To do so execute the command:


Step 2: Unzipping and extracting.

After downloading unzip the file using the command:


In case you do not have to unzip installed then you can install it by using:

sudo apt-get install unzip

Step 3: Copy to the bin location.

Once unzipping is finished now you need to copy the files to the bin directory, to do so use the command:

sudo cp watcherd-master/watcherd /usr/bin/

Step 4: Check the tool is installed properly or not.

You can check the user manual by using the help command:

watcherd --help


Or you can check with –version

watcherd --version


Watcherd Working:

Step 1: Create a directory.

Make a directory named test in your current working directory 

mkdir sample

Step 2: Now start watcherd.

Now deploy watcherd using the following parameters:

watcherd -v -p ~/sample -a "echo added %n" -d "echo deleted %n" -t "ls -l ~/sample" &



  • -v stands for verbose which will verbosify the output of the command
  • -p stands for the path to directory, and we have used test for the subject
  • -a stands for  executing the command if any directory path is created , we have used echo for printing but you can also add any other way of scripting and make the best use out of it.
  • -d stands for executing the command if any directory path is deleted and vice versa.
  • %n will be substituted with directory name or you can use %p to get a full path to the created or deleted directory
  • -t “ls -l ~/test” execute command after triggering
  • & run in background

Step 3: After executing the command check if it’s running by using the command:

ps ax | grep watcherd


Now let’s do some adding and deleting directory in our test folder and see what happens, directory can be named anything, for instance we are using anon.

mkdir sample/anon 


rmdir sample/anon


After executing the command you will be able to see an output generated by watcherd.

My Personal Notes arrow_drop_up
Last Updated : 29 Jan, 2021
Like Article
Save Article
Similar Reads
Related Tutorials