A command to show the directory structure

Posted on 1998-07-01
Last Modified: 2013-12-23
I want to know if there a command in UNIX like  the "tree" command  in DOS where you can see all the structure of your directory and subdirectories....

that' its

Thx in advance
Question by:tusken
LVL 84

Expert Comment

ID: 1582902
find . -print | perl -pe 's#[^/]*/#   #g'
LVL 10

Expert Comment

ID: 1582903
Another way if you don't have perl use
If you want an output like DOS there is no such program. You have to write your own.

Expert Comment

ID: 1582904

Expert Comment

ID: 1582905
you may use "ls -l|more" to obtain a directory listing.
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails


Author Comment

ID: 1582906
The answer that suited the best my question is the one from OZO so i'll reopen my question and if ozo wants to answer it i'll give those points to him

For the others...... thx anyway!!!
LVL 84

Expert Comment

ID: 1582907
You seem to imply that there's room for the answer to be better suited.
Was there something you would have preferred to change?

Author Comment

ID: 1582908
No sorry (english is not my base language!!) i meant that your answer was the one i was looking for no it was alright... but if i would like just to have the directory and not all the file in it what would the command be like???

thx in advance ....and still learning unix AND english :-)

LVL 84

Accepted Solution

ozo earned 50 total points
ID: 1582909
find . -type d -print | perl -pe 's#[^/]*/#   #g'
du -r | perl -pe 's#[^/]*/#    #g'
  (which shows the tree backwards)

Author Comment

ID: 1582910
Thx a lot!!!

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

What is IRC? IRC (Internet Relay Chat) is a form of communication between multiple users. It is available freely to anyone with inernet access. IRC is a great way to communicate with others e.g. There is an IRC channel for Ubuntu Linux, which is fo…
Article by: IanTh
Hi Guys After a whole weekend getting wake on lan over the internet working, I thought I would share the experience. Your firewall has to have a port forward for port 9 udp to your local broadcast x.x.x.255 but if that doesnt work, do it to a …
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now