Find target given a symlink

To find the target of a symbolic link i.e. the real file or directory that your symlink points to…

realpath [symlink]

Or:

readlink -f [symlink]

This can be useful in shared hosting environments where your home or html directory is a link but some program config requires a real path. E.g:

whoever@wherever ~ $ realpath public_html
/var/www/vhosts/whoever/

References:

Last modified: 23/03/2015 Tags:

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top