realpath - return the canonicalised absolute pathname
2. SYNOPSIS ▲
" filename " ...
3. DESCRIPTION ▲
realpath converts each filenameargument to an absolute pathname, which has no components that are symbolic links or the special
.. directory entries. (See
R realpath (3) for more information.)
Please note that mostly the same functionality is provided by the `-f' option of the
R readlink (1) command.
-s option is used
realpath only removes the
.. directories, but not symbolic links from filename . If the given filenameargument is relative (i.e. does not start with ` / '),
realpath -s prepends to it the current directory name as obtained from the
R getcwd (2) system call before further processing.
Each converted pathname is output to the standard output, on its own line.
4. OPTIONS ▲
R .. , components, but do not resolve symbolic links.
Separate output filenames with the null character instead of newline, so it can be used with the ` -0 ' option of
R xargs (1).
Print short usage information.
R realpath 's version number.
5. EXAMPLES ▲
For the examples below let's suppose that /usr/bin/X11is a symbolic link, pointing to directory /usr/bin .
5.1. Example 1 ▲
Regardless of what the current directory is .nf
5.2. Example 2 ▲
When the current directory is /usr/bin/X11 (which is still a symbolic link to /usr/bin ), the output of both .nf
5.3. Example 3 ▲
Providing that the current directory is /home/user (and the directory exists before and during the realpath run), the command .nf
will fail with the following error .nf
will return .nf
6. EXIT STATUS ▲
realpath returns a zero exit code when allpathnames were successfully converted.
In case of any errors (e.g. missing or unavailable directories in the path),
realpath prints error message to stderr and returns a non-zero exit code.
7. SEE ALSO ▲
8. BUGS ▲
Hopefully none :)
If you find some, please report them via the normal Debian bug reporting system, see the file /usr/share/doc/debian/bug-reporting.txtin the package doc-debian or the
R reportbug (1) man page.
9. AUTHOR ▲
Originally written by Lars Wirzenius <>, as a part of the dwww package. Robert Luberda <> currently maintains and extends it.
realpath is licensed via the GNU General Public License. While it has been written for Debian, porting it to other systems is strongly encouraged.