APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

readlink


© September 2005 Tony Lawrence

Symbolic links can sometimes be confusing, particularly when one symbolic link includes another in its path:

lrwxrwxrwx   1 pcunixapl pcunixapl        18 Sep  6 10:23 foo-web -> vhosts/foo-web.com
lrwxrwxrwx   1 pcunixapl pcunixapl        19 Sep  5 05:54 vhosts -> /home/httpd/vhosts/
 

You can quickly resolve symbolic links with readlink:

$ readlink vhosts
/home/httpd/vhosts/
readlink foo-web
vhosts/foo-web.com
 

But that foo-web isn't really 100% true, because "vhosts" is another symbolic link itself. If you want it to follow the trail, use "readlink -f":

$ readlink -f foo-web
/home/httpd/vhosts/foo-web.com
 

There are a couple of other options to readlink that make it easy to use in shell scripts; it's always nice when the author of a utility pays attention to little details like that.


Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

->
-> readlink


Inexpensive and informative Apple related e-books:

Take Control of IOS 11

Take Control of Preview

Take Control of Upgrading to El Capitan

Take control of Apple TV, Second Edition

Take Control of Pages




More Articles by © Tony Lawrence




Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us


Printer Friendly Version





It's hard to study much history and not dislike religion - (Tony Lawrence)




Linux posts

Troubleshooting posts


This post tagged:

Linux

Unix



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode