Monday, July 24, 2006

namei

I stumbled today on namei, an executable found on Linux. I'm not sure why I've never been exposed to it before, FreeBSD not packaging it comes to mind, but this is truly useful. In a world of softlinks, with all their benefits and drawbacks, namei follows the trail until it reaches a real end point.

Here's a sample output on a RHEL box:

# namei `which java`
f: /usr/bin/java
d /
d usr
d bin
l java -> /etc/alternatives/java
d /
d etc
d alternatives
l java -> /usr/lib/jvm/jre-1.4.2-gcj/bin/java
d /
d usr
d lib
d jvm
l jre-1.4.2-gcj -> java-1.4.2-gcj-1.4.2.0/jre
d java-1.4.2-gcj-1.4.2.0
d jre
d bin
- java

The best part is that I know exactly how this was coded ... and that I don't have to do it myself.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home