Symlink

A symbolic link, also termed a soft link, is a special kind of file that points to another file, much like a shortcut in Windows or a Macintosh alias. Resources

To create a symbolic link pass the -s option to the ln command followed by the target file and the name of link. In the following example a file is symlinked into the bin folder.

ln -s ~/code/notes/notes ~/bin/notes
ls -l ~/bin/ | grep notes
lrwxrwxrwx 1 george users   29 Oct  7 10:07 notes -> /home/george/code/notes/notes

In ROS

We do --symlink-install so that we don’t have to rebuild every single time.

What is actually happening under the hood?

Question is important to ask, because I see some weird behavior with pure python packages,

Getting the real path

To get the actual path to the file, it seems that there are multiple ways to do this.

readlink -f symlink_file

I saw that at NVIDIA, we do

realpath symlink_file
  • realpath isn’t available on all flavors of linux

https://stackoverflow.com/questions/16017500/how-to-see-full-absolute-path-of-a-symlink