personal_cloud
personal_cloud

Reputation: 4494

How can I avoid 'are the same file' error when using 'ln' in Linux?

I'm trying to link a directory to another location. Using the following command

ln -sf . dot

succeeds the first time, but it returns an error the second time:

ln -sf . dot

Output:

ln: '.' and 'dot/.' are the same file

This was on Ubuntu 16.04.12 (Xenial Xerus).

How can I avoid this error?

Upvotes: -3

Views: 1703

Answers (1)

KamilCuk
KamilCuk

Reputation: 141060

You can use ln -n to not dereference the existing symbolic link. See man ln.

ln -nsf . dot

Upvotes: 2

Related Questions