Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
ls -l java
lrwxrwxrwx 1 root root 22 2019-02-17 11:37 java -> /etc/anotherLink/java

when I do ls -l it shows path to file, but that file can also be a link. is there any way to show path to real file?

share|improve this question

I think what you want is readlink:

readlink -f java

To find this, I asked which manual page might by appropriate for symbolic links.

apropos "symbolic link"

It returned a reference to readlink, so I used the manual:

man readlink

I read the manual page:

-f, --canonicalize canonicalize by following every symlink in every component of the given name recursively; all but the last component must exist

Is this what you are looking for?

share|improve this answer

Try using file command.

It shows details about a given file (type, contents format)


$ cp -s
$ file symbolic link to `'
share|improve this answer
I think the question is about one more level of links, e.g. one (link) -> two (link) -> three (regular file) and a command to show one points to three. file one will show one: symbolic link to 'two' whereas readlink -f one will show /abs/path/to/three. – gertvdijk May 30 '13 at 9:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.