is there a way to see the actual contents of a symlink?
Solution 1:
The ls -l
command will show you that:
$ ls -l foo
lrwxrwxrwx 1 user group 11 2010-12-31 19:49 foo -> /etc/passwd
Or the readlink
command:
$ readlink foo
/etc/passwd
So, the symbolic link foo
points to the path /etc/passwd
.
Solution 2:
You can call the readlink(2)
function, which will place the linked-to name into a buffer.
Note that the result has a length (stored in the return value) rather than being NUL-terminated. So if you want to use it as a string, append a NUL yourself.
Most higher-level/scripting languages, such as perl or python, will provide a readlink wrapper that converts to the usual language-appropriate string type, so you won't be bothered by details such as NUL-termination.
Solution 3:
Regarding to man page http://man7.org/linux/man-pages/man7/symlink.7.html symlink is regular file (with special flag) with path to target in its content. So you could copy symlink to FAT partition and read it content there.