Using tree to display only certain directories


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Using tree to display only certain directories
# 1  
Old 01-06-2013
Using tree to display only certain directories

I want to use tree to display the directory tree. It is easy to use

Code:
tree -d -L 2

However I would like to run it on specific list of directories. Can such a thing be performed?

Example:

Code:
[chrisd@uol] /media/academic-repo/chrisd/literature  
tree -d prose -L 2
prose
├── computer-technology
│** ├── artificial-intelligence
│** ├── databases-and-SQL
│** ├── methodology
│** ├── networks
│** ├── programming-languages
│** └── unix
├── culinary
├── history-geography
│** ├── ancient-egypt
│** ├── ancient-greece-and-rome
│** ├── art-history
│** ├── britain
│** ├── central-and-south-america
│** ├── china
│** ├── europe
│** ├── Facts on File - Encyclopedia of World History (2008)
│** ├── general-history
│** ├── japan
│** ├── military-and-naval-history
│** ├── united-states-and-canada
│** └── world-history
├── philosophy
│** ├── aestetics
│** ├── economics
│** ├── epistemology
│** ├── ethics
│** ├── logic
│** ├── metaphysics
│** ├── psychology
│** └── sociology
├── science
│** ├── biology
│** ├── chemistry
│** ├── engineering
│** ├── geology
│** ├── introductions-science
│** ├── mathematics
│** ├── other
│** ├── paleontology
│** ├── physics
│** └── tnbooks
└── sports-travel
    ├── cinema
    ├── dance
    ├── diving
    ├── theatre-and-stage
    └── travel

48 directories

However I want to display the tree for two directories only, computer-technology and science.

Last edited by kristinu; 01-06-2013 at 03:30 PM..
# 2  
Old 01-06-2013
Code:
tree [options here ] computer-technology  science

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Display largest files in multiple directories

Trying to locate the 25 largest files with read/execute world permissions to be displayed from a combination of 4 different directories. I'm rather new at UNIX and trying to learn the basics. This is what I have come up with so far: find /dir1 /dir2 /dir3 /dir4 -perm -u+rx | sort -nr | head... (1 Reply)
Discussion started by: malk71
1 Replies

2. Shell Programming and Scripting

How to run a script/command on all the directories in a directory tree?

How to run a script/command on all the directories in a directory tree? The below script is just for the files in a single directory, how to run it on all the directories in a directory tree? #!/bin/sh for audio_files in *.mp3 do outfile="${audio_files%.*}.aiff" sox "$audio_files"... (2 Replies)
Discussion started by: temp-usr
2 Replies

3. Shell Programming and Scripting

How to display only Directories in filesystem?

Hi, I want to display only directories inside a particular file system. TIA (2 Replies)
Discussion started by: sumanthupar
2 Replies

4. Shell Programming and Scripting

Display top ten directories by size

Hi, I am new to Unix. I want to display top 10 folders by size. I tried with du -ksl * | sort -nr | head -10 command .But I am getting the following error -bash: /usr/bin/du: Argument list too long Can some one help me. Thanks. (5 Replies)
Discussion started by: Satyak
5 Replies

5. Solaris

What command can display files in a tree?

Is there a command that displays a certain path of files in a tree just like the dos command 'tree'? (17 Replies)
Discussion started by: Bradj47
17 Replies

6. Shell Programming and Scripting

Display only subdirectories from given directories

Hi Genius, I would like to display all the subdirectories only with timestamp. For exmple: Given Directory : orabkup /orabkup total 11365112 drwxr-xr-x 9 oracle oradba 256 Jan 03 16:01 db1 /orabkup/db1: total 0 drwxr-xr-x 2 oracle oradba 256 Jan 03 16:01... (8 Replies)
Discussion started by: HAA
8 Replies

7. UNIX for Dummies Questions & Answers

How to display directories recursively?

Cannot find how to list the directory structure of a volume recursively. Do not want the files reported. Say I have 100 directories and 10,000 files, I do not want 10,000 lines of output. (If this is relevant, I am using the terminal on my OSX Mac). I hope this is easy - there should be an easy... (5 Replies)
Discussion started by: jwriter
5 Replies

8. Shell Programming and Scripting

export display of directories of remote machine

hi I wanted to export the display of all directories of home with their respective subdirectories and files if any on my local pc. this home directory is of some remote machine . using ssh remote login and then using struct direct i can just gate name list of directories . but not the display... (2 Replies)
Discussion started by: bhakti
2 Replies

9. Shell Programming and Scripting

Bash Script to display directories in Path?

Hello there, As a newbie: The directories in PATH can be hard to distinguish when printed out as one line with colon .Please, can i have a sample script to display them,one to a line. Thank you. (1 Reply)
Discussion started by: debut
1 Replies

10. UNIX for Dummies Questions & Answers

how can i display the list of directories(only)

when i am giving ls command it displays all the files and directories how can we the list of directories in the current directory? (3 Replies)
Discussion started by: indianguru
3 Replies
Login or Register to Ask a Question