Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How would I efficiently go about searching for .png | .svg | .xpm image-files in a complex and recursively structured hierarchy in one query, using terminal (and if possible | (pipe) tree in the same query, to get a nice output/overview, like in the example below:

├── arrows
│   ├── submenu01.png
│   └── submenu02.png
├── awesome
   ├── 01
   │   ├── ac.png
   │   ├── awesome.png
   │   ├── bat_low.png
   │   ├── bat_no.png
   │   │   ├── close_normal_all.png
   │   │   ├── floating_focus_inactive.png
   │   │   ├── floating_normal_active.png
   │   ├── vol_low.png
   │   ├── vol_mute.png
   │   ├── vol_no.png
   │   ├── vol_up.png
   │   └── widget_bg.png
   ├── antilight_by_sunjack94-d3ddff6.tar
   ├── As_It_Fades_by_synorgy.png

I'd like to do this in:


Any help is highly appreciated, even if it doesn't fully fit my request!

share|improve this question
up vote 10 down vote accepted

Install the package tree than use

tree -P '*.png|*.svg|*.xpm' --prune /usr/share/
share|improve this answer
I am getting "tree: Invalid argument --'." when using --prune`. and I did not found this option in man pages. Would you plz put some light :) – souravc Feb 24 '14 at 19:24
Copy and paste the command. – wojox Feb 24 '14 at 19:30
Sorry. --prune needs at least Ubuntu 12.10 – Florian Diesch Feb 24 '14 at 19:33
(Or you could just pull tree back from a later release) – Oli Feb 24 '14 at 21:13
Thank you Florian for your answer and sorry for the late reply. Is there any alternative to prune you know of for 11.10 that i could use?! I'll try Olis' suggestion and if that doesn't work I'll wait a few days before I accept your answer. +1 – v2r Feb 25 '14 at 17:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.