Skip to content
Advertisement

Symbolic Link Edits and differences to hard link [closed]

I just created a symlink to a directory using:

ln -s /path/to/real/ link

1 – If I then cd into link/ will any changes I make in there be reflected in the original directory?

2 – Additionally, the source directory is a git repo, so can I do the git commands from the symlink’ed directory?

3 – These answers and any general explanation about the differences between sym/hard links (or ln in general) would rock.

Thank you!

Advertisement

Answer

When you do cd link/, your current directory becomes /path/to/real and any changes you make in the directory are in ‘the real directory’.

Beware of cd -L vs cd -P — see POSIX on cd — and similarly with pwd.

Advertisement