Solved

"tree" equivalent in a Unix AIX Environment

Posted on 2008-10-06
7
5,618 Views
Last Modified: 2013-11-17
I am doing a SAP migration from an onsite data farm to a Collocation out in Phoenix, IBM is requesting a hierarchy break down. instead of typing this all out i know in Linux there is a command such as tree. i have tried that on my AIX SAP machine and have gotten no response. is there an equivalent command on UNIX to get this structure read out, without the filenames in the directory also? Below is what im looking for. any help would be greatly appreciated.
.
   |-bin
   |-boot
   |---grub
   |---lost+found
   |-dev
   |---bus
   |-----usb
   |-------001
   |---disk
   |-----by-id
   |-----by-label
   |-----by-path
   |-----by-uuid
   |---input
   |---mapper
   |---net
   |---pts
   |---shm
   |-etc

0
Comment
Question by:techsupportcpm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
7 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 22651227
Hello techsupportcpm,

You can try
find / -type d

replace / with whatever directory whose structure you wish to have. This would give you the directory structure but it would not be formatted like tree command - just one directory per line.

Regards,
sunnycoder
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 22651609
please see link below to create a tree script of your own:

http://www.centerkey.com/tree/
0
 
LVL 2

Author Comment

by:techsupportcpm
ID: 22651748
yea google already kicked back that search and it was tried. the command itself does not run "ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/'" from a CLI.
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 40

Accepted Solution

by:
omarfarid earned 250 total points
ID: 22651794
do you mean that the script does not run? have you downloaded the script or you just copy and paste from the site? I personally downloaded the script and ran it on solaris 10 and it is fine.

If you have problem then see the attached snippet

Google is of much help any way :)
#!/bin/sh
 
#######################################################
#  UNIX TREE                                          #
#  Version: 2.2                                       #
#  By Dem Pilafian                                    #
#  File: ~/apps/tree/tree.sh                          #
#                                                     #
#  Displays Structure of Directory Hierarchy          #
#  -------------------------------------------------  #
#  This tiny script uses "ls", "grep", and "sed"      #
#  in a single command to show the nesting of         #
#  sub-directories.                                   #
#                                                     #
#  Setup:                                             #
#     % cd ~/apps/tree                                #
#     % chmod u+x tree.sh                             #
#     % ln -s ~/apps/tree/tree.sh ~/bin/tree          #
#                                                     #
#  Usage:                                             #
#     % tree [directory]                              #
#                                                     #
#  Examples:                                          #
#     % tree                                          #
#     % tree /etc/opt                                 #
#     % tree ..                                       #
#                                                     #
#  Public Domain Software -- Free to Use as You Like  #
#  http://www.centerkey.com/tree                      #
#######################################################
 
echo
if [ "$1" != "" ]  #if parameter exists, use as base folder
   then cd "$1"
   fi
pwd
ls -R | grep ":$" |   \
   sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/'
# 1st sed: remove colons
# 2nd sed: replace higher level folder names with dashes
# 3rd sed: indent graph three spaces
# 4th sed: replace first dash with a vertical bar
if [ `ls -F -1 | grep "/" | wc -l` = 0 ]   # check if no folders
   then echo "   -> no sub-directories"
   fi
echo
exit

Open in new window

0
 
LVL 40

Expert Comment

by:omarfarid
ID: 22660354
techsupportcpm did not answer my last question although answer was provided
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 22665842
Why has the close process been restarted when omarfarid has posted a valid objection?
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question