Linux Basics: ‘tree’ Command Usage
Hello Unixmen Readers,
In this article we will look at how to list contents in a directory as the the title implies in a tree format.
You might be thinking why will you want to list the contents of a directory with tree whilst we can use ls? I will say tree is just an advanced command based on ls.
Tree is a recursive directory listing program that produces a depth indented listing of files and directories which are colored.
First, let’s verify tree is installed in our system or not. By running:
$ tree --version
es@es-lunabox:~$ tree --version tree v1.5.3 (c) 1996 - 2009 by Steve Baker, Thomas Moore, Francesc Rocher, Kyosuke Tokoro
If you do not see the output it means tree is not installed, hence we need to install. tree is available in most distros default repository.
Install in Ubuntu, Elementary OS, Linux Mint, Crunchbang and other Ubuntu & Debian derivatives
$ sudo apt-get install tree
Install in Fedora and its derivatives
$ sudo yum install tree
Install in Arch Linux, Manjaro an its derivatives
$ sudo pacman -Sy tree
1. tree with no option; Running tree with no option recursively list directories and files under the current path (excluding hidden one).
2. Display hidden files and directories: By default tree doesn’t display hidden files. To display these files and directories use the -a option as used with ls.
$ tree -a
3. List directories only:
$ tree -d
4. Forward use tree on a directory:
$ tree <directory>
Run man tree for more on how to use tree.
Like us on Facebook
We need your assistance to stay live
This week Top Posts
- Top Things To Do After Installing Ubuntu 13.10 'Saucy Salamander' : Ubuntu 13.10 Saucy Salamander will be released on coming October 17th with many new salient featur...0 comments |
- Install Power Commands 0.1.5 On Ubuntu 14.04/13.10/12.10/12.04 : Power Commands, power management application created by the Atareao team , this app helps users to...0 comments |
- Install Uget Download Manager In Ubuntu, Fedora, Debian : uGet is a very light-weight and powerful open source download manager. On March 4th, 2014 Uget Do...0 comments |
- How To Upgrade From Ubuntu 13.04 Raring To Ubuntu 13.10 Saucy Salamander : Ubuntu 13.10 Saucy will be released on October 17th. Hope it will come with lot of improvements and ...0 comments |
- Download Elementary OS 'Luna' Official Wallpapers : Hi Guys, Am a great lover of Elementary OS, so I like to move almost everywhere with some its beaut...0 comments |
- Install Crashplan backup tool in Linux : CashPlan is an automated backup solution that either uses the CrashPlan Central server or any other ...0 comments |
- Fedora 21 Scheduled For Release In October
- Install Uget Download Manager In Ubuntu, Fedora, Debian
- Download Elementary OS ‘Luna’ Official Wallpapers
- Install Power Commands 0.1.5 On Ubuntu 14.04/13.10/12.10/12.04
- 5 Android Apps that’s Going to Make Running Your Business Less Stressful
- Puppet agent Install Using Script
- Install Corosync and Pacemaker On CentOS 6.5
- Install Fail2Ban On Ubuntu Server 13.04/13.10
- How To Install Google Chrome in Fedora 20, 19, 18
- How to surf using Tor Browser Bundle
This work by unixmen.com is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Copyright © 2008-2013 Unixmen.com .