TreeView in RHEL 4

Hi,
I have got a folder structure in Linux (RHEL 4) and want to get treeview of he same.
I got the 'tree' command for getting the result but my Linux has not got tree command.
I had downloaded the tree package and tried to install. It required some dependency packages like glibc. I tried to install that too but tree package is not installed.

A binary package for tree should be on the RHEL4 media. Have you also searched for one at rpmfind.net, rpm.phone.net and other RPM repositories?

Hi.

If you cannot find a binary, perhaps this perl code will serve:

#!/usr/bin/env bash

# @(#) tree	Display structure of directory, recursive, perl.
# $Id: tree,v 1.2 2012/03/22 09:27:54 drl Exp $

# Adapted from post in comp.lang.perl.misc.

set +o nounset
LC_ALL=C ; LANG=C ; export LC_ALL LANG

START=${1-.}

find $START -print |perl -lpe 's,[^/]*/([^/]*)$,`--$1,;s,[^/]*/,|  ,g'

exit 0

producing as a demonstration:

$ ./tree
.
`--RCS
|  `--s2,v
|  `--tree,v
`--readme.txt
`--s1
`--s2
`--tree
`--t1

It is not as complete as:

tree v1.5.2 (c) 1996 - 2008 by Steve Baker, Thomas Moore, Francesc Rocher, Kyosuke Tokoro

but it is useful.

Best wishes ... cheers, drl

1 Like