Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose I have a folder foo with the two content:


Now I create a new symlink called fo2 which points to directory foo:

cp -s -R /home/user123/foo /home/user123/fo2

It's working okay. But then, I try to made new files in foo folder, say data2.txt. When I opened fo2 folder, it only contains a symlink to data1.txt and cfg.txt data2.txt doesn't exist.

How to make the content of fo2 folder automatically synced with with foo so data2.txt automatically appears in fo2?

ln -s is not an option because I want the content of cfg.txt in foo and fo2 folder to be different. If I use copy -s -R, later I just come inside fo2 folder, delete cfg.txt symlink and recreate a real cfg.txt with different content.

share|improve this question
Do you really want to symlink the content of the directory, or the directory itself? To me, it sounds like ln -s /home/user123/foo /home/user123/fo2 is what you want. – htorque Feb 29 '12 at 8:59
I want to symlink both. If I use ln -s and opened fo2 folder, it will have 1.txt and 2.txt of actual folder, while I want the content of 1.txt in foo and fo2 folder to be different (for example, configuration files). If I use cp -s -R, I can open fo2 folder, delete 1.txt symlink and recreate a new 1.txt with different content – Asker Feb 29 '12 at 9:03

If the locations are both on the same filesystem, you should use hard links. Otherwise, you'll have to setup some sort of synchronization, but that will be extremely inefficient in comparison.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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