5

Can we create a symbolic link to existing directory?

Example: I want to create a symlink from /var/logs to /dump/logs (/dump/logs is exiting directory) if i do ln -s /var/logs /dump/logs i get below error

ln: failed to create symbolic link '/dump/logs': File exists

stark
  • 12,615
  • 3
  • 33
  • 50
Shree
  • 111
  • 1
  • 2
  • 8
  • Do you want a symbolic link named `/var/logs` pointing to `/dump/logs` or the other way round? – wastl Jan 06 '21 at 13:58
  • I want to point all the content of /var/logs to /dump/logs.. In short when i do ls -l /dump/logs - this should show the content of /var/logs.. – Shree Jan 06 '21 at 14:10
  • 1
    Make sure that there are no existing /dump/logs "hard" directories – Raman Sailopal Jan 06 '21 at 14:28

1 Answers1

2

The existent one goes first before the link name:

ln -s /dump/logs /var/logs
dibery
  • 2,760
  • 4
  • 16
  • 25