is there a way to see the actual contents of a symlink?

fabio picture fabio · Jan 1, 2011 · Viewed 32.3k times · Source

When you do

cat some-symlink-to-some-real-file

it shows the contents of the real file, not what is within the symlink itself. Is there a way to see what's actually in it?

Answer

PleaseStand picture PleaseStand · Jan 1, 2011

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.