Skip to main content
14 events
when toggle format what by license comment
Oct 31, 2022 at 9:06 comment added Basilevs @comfreak it works for me on macOS 12.6 too, but man readlink says that -f accepts format value. I'm confused
Oct 21, 2022 at 14:02 comment added comfreak @SnoringFrog: I just tested readlink -f on the current macOS (12.6) and it works as intended. If the argument is a symlink, it will show the absolute path of the symlink target.
Oct 8, 2021 at 7:58 comment added Ade Dyas i got ` -f: command not found` in gitlab ci, anyone can help me?
Sep 9, 2021 at 10:27 comment added Oliver Gondža From readlink manpage (coreutils 8.32-1): "Note realpath(1) is the preferred command to use for canonicalization functionality". They are both from coreutils.
Oct 11, 2019 at 13:09 comment added nagylzs I think that OP did not ask for resolving symlinks. If that is true, then this is a faulty answer. An "absolute path" and "resolved symlinks" are two different things. For getting absolute paths without resolving symlinks, realpath -s can be be used.
Mar 15, 2018 at 10:02 comment added Elise van Looij Works fine on MacOS 10.3 (Mavericks)
Sep 11, 2016 at 8:15 comment added GDP2 @Dalin These options can be found by installing the GNU coreutils.
Jan 14, 2016 at 18:53 comment added SnoringFrog @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
Aug 8, 2014 at 8:26 comment added mykhal hluk: -f option is also the one to use in OpenBSD
Jul 24, 2014 at 16:13 comment added iconoclast @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
May 21, 2011 at 7:02 comment added Matt Joiner It seems to me that -m is the best option to use.
Nov 16, 2010 at 0:15 comment added catphive 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.
Oct 12, 2010 at 14:54 comment added hluk I would rather use '-f' instead of '-e' so that we can see absolute path of a nonexistent file.
Oct 12, 2010 at 14:34 history answered Dennis Williamson CC BY-SA 2.5