In Bash, how do I safely determine what a soft link points to?
stat <linkname>
Example:
stat /usr/local/cuda
First 2 lines will give:
File: '/usr/local/cuda' -> 'cuda-8.0'
Size: 8 Blocks: 0 IO Block: 4096 symbolic link
...
readlink -f <linkname>
See the readlink(1) man page for Linux, FreeBSD, NetBSD, OpenBSD, DragonFly or the GNU coreutils info page.