Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 159391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:51:03+00:00 2026-05-11T10:51:03+00:00

What are the best tools/programming-techniques for following a complicated nesting of symlinks and completely

  • 0

What are the best tools/programming-techniques for following a complicated nesting of symlinks and completely capturing and reporting on every symlink along the way, including those in the middle of a path (See below for more info).

Here’s a specific example. Consider the following output from a shell command

 ls -l /Library/Java/Home  lrwxr-xr-x  1 root  admin  48 Feb 24 12:58 /Library/Java/Home -> /System/Library/Frameworks/JavaVM.framework/Home 

The ls command lets you know that the file /Library/Java/Home file is a symlink to another location. However, it doesn’t let you know that the thing it’s pointing to is also a symlink

ls -l /System/Library/Frameworks/JavaVM.framework/Home lrwxr-xr-x  1 root  wheel  24 Feb 24 12:58 /System/Library/Frameworks/JavaVM.framework/Home -> Versions/CurrentJDK/Home 

This, in turn, doesn’t let you know that part of the path of the pointed to file is a symlink.

ls -l /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK lrwxr-xr-x  1 root  wheel  3 Feb 24 12:58 /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK -> 1.5 

Which, just to complete this tale, is another symlink

ls -l /System/Library/Frameworks/JavaVM.framework/Versions/1.5 lrwxr-xr-x  1 root  wheel  5 Feb 24 12:58 /System/Library/Frameworks/JavaVM.framework/Versions/1.5 -> 1.5.0 

Finally pointing at a ‘real’ folder.

Are there any tools that can visualize the full chain of links for you in some way (either graphically or plain old text)? I’m sure one could script this themselves (and if you want to, please do it and share!), but it seems like the kind of thing that would be fraught with ‘oh, crap, edge case. Oh, crap, ANOTHER edge case’. I’m hoping someone’s already gone to the bother.

I do freelance/contract work, and everyone uses symlinks slightly differently to install their PHP applications on a web-server. Half my job is usually un-nesting this (inevitably) undocumented hierarchy so we know where to put our new code/modules.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:51:03+00:00Added an answer on May 11, 2026 at 10:51 am

    Tcl has a command [file type $filename] that will return ‘link’ if it’s a link. It has another command [file link $filename] that will return what the link points to. With those two commands it’s possible to take a link and follow the links until you get to an actual file.

    Perhaps something like this off the top of my head:

    #!/usr/bin/tclsh  proc dereferenceLink {path {tree {}}} {     if {[file type $path] == 'link'} {         set pointsTo [file link $path]         if {[lsearch -exact $tree $path] >= 0} {             lappend tree $path             return '[join $tree ->] (circular reference)'         } else {             lappend tree $path             return [dereferenceLink $pointsTo $tree]         }     } else {         lappend tree $path         return [join $tree '->']     } }  puts [dereferenceLink [lindex $argv 0]] 

    You’ll get output that looks like:

    foo->bar->baz

    If there’s a circular link it will look like:

    foo->bar->baz->foo (circular reference)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What are the best IDE's / IDE plugins / Tools, etc for programming with
What are the best tools for AJAX development? I know of firebug for firefox,
What are the best tools (most efficient) available in .NET (C#) for calculating: integrals
What tools are best for measuring web-services performance? It would be nice to get
Best practices or tools for installing a SQL Server database I have a SQL
Can anyone suggest what software or tools that the best to design icon and
What're the best practices for CSS/HTML minimizing? I'm looking for server side tools to
When I am developing a bunch of designers/tools, what are some of the best
I've noticed that when I update my programming tools (packages) on Fedora using PackageKit,
I've seen Best tools for working with DocBook XML documents , but my question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.