linuxshellfilesystemssymlinkcat

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


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?


Solution

  • 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.