Realpath

From LQWiki
Jump to navigation Jump to search

realpath is a program to resolve a path to an item in the filesystem. Depending on switches, it can resolve symlinks and ".." elements to produce a simple path, either absolute or relative to the current directory. It can be very handy in scripts or wherever there are multiple paths that could lead to the same file or directory.

Examples

   user@mymachine:~$ realpath . # note the dot
   /home/user
   user@mymachine:~$ ln -s /usr/bin ub
   user@mymachine:~$ realpath ub/realpath
   /usr/bin/realpath

Provided by

Not all distributions provide this command, but most (all?) of the ones that do incorporate this from the GNU Coreutils: and use its man page

See Also

This article is a stub and needs to be finished. Plunge forward and help it grow!