Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

13
  • 66
    I would rather use '-f' instead of '-e' so that we can see absolute path of a nonexistent file.
    – hluk
    Commented Oct 12, 2010 at 14:54
  • 6
    This looks like the simplest to me, while also being portable. readlink is port of the gnu coreutils, so it will be installed on almost any linux distribution, except for some embedded ones.
    – catphive
    Commented Nov 16, 2010 at 0:15
  • 21
    It seems to me that -m is the best option to use. Commented May 21, 2011 at 7:02
  • 2
    @Dalin: /usr/bin/readlink on Mavericks. Or did you mean those options are not found on OS X? It seems to be a stunted BSD version... :p
    – iconoclast
    Commented Jul 24, 2014 at 16:13
  • 17
    @iconoclast Those options aren't available on OSX, and as per the BSD readlink manpage: only the target of the symbolic link is printed. If the given argument is not a symbolic link, readlink will print nothing and exit with an error, so readlink won't work for this purpose on OSX Commented Jan 14, 2016 at 18:53