Lets say I have 4 java instances running on my linux system, in separate directories, all of which have a config file named config.yml. I want to be able to edit 1 config.yml and have it copy across the multiple directories in real time. For example:

  • ../dir1/config.yml
  • ../dir2/config.yml
  • ../dir3/config.yml
  • ../dir4/config.yml

I want dir2 and dir3 to reference the config.yml in dir1. Is there a linux-based program or software that will allow me to do this? Or allow me to quickly sync the config.yml file across the directories?

In addition to this question, would it be possible to have it sync across multiple systems, too?

Thanks in advance!


Use symbolic links

Keep your /path/dir1/config.yml file and link the others

ln -s /path/dir1/config.yml /path/dir2/config.yml
ln -s /path/dir1/config.yml /path/dir3/config.yml
ln -s /path/dir1/config.yml /path/dir4/config.yml

those 3 lines are making "shortcuts" to the dir1 config. Then if you edit the file from any of those path, it will change the "dir1" file.

  • Thanks for the quick reply! This seems to create a shortcut folder called config.yml instead of a shortcut file. Is there perhaps another command prefix that I need to include whilst performing the action? – ScottehBoeh Jun 23 '19 at 12:05
  • no, you have to do it this way. That if you create this link and try to open it with a file editor? – darxmurf Jun 24 '19 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.