Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CentOS directory structure as tree?

Tags:

linux

bash

centos

Is there an equivalent to tree on CentOS?

like image 351
nsfyn55 Avatar asked Apr 20 '11 15:04

nsfyn55


People also ask

How do I show directory in tree format?

You need to use command called tree. It will list contents of directories in a tree-like format. It is a recursive directory listing program that produces a depth indented listing of files. When directory arguments are given, tree lists all the files and/or directories found in the given directories each in turn.

Is a directory a tree structure?

The directory is structured in the form of a tree. It also has a root directory, and every file in the system has a unique path. A directory within a tree-structured directory may contain files or subdirectories. Special system calls are used to create or remove directories.

How do I create a directory tree in Linux?

Creation of an entire directory tree can be accomplished with the mkdir command, which (as its name suggests) is used to make directories. The -p option tells mkdir to create not only a subdirectory but also any of its parent directories that do not already exist.

What is directory tree in Linux?

A directory tree on a Linux system is a way to see all of the directory and sub directories in a provided filesystem path.


1 Answers

If tree is not installed on your Centos system (I typically recommend server setups to use minimal install disk anyhow) you should type the following at your command line:

# yum install tree -y 

If this doesn't install it's because you don't have the proper repository. I would use the Dag Wieers repository:

http://dag.wieers.com/rpm/FAQ.php#B

After that you can do your install:

# yum install tree -y 

Now you're ready to roll. Always read the man page: http://linux.die.net/man/1/tree

So quite simply the following will return a tree:

# tree 

Alternatively you can output this to a text file. There's a ton of options too.. Again, read your man page if you're looking for something other than default output.

# tree > recursive_directory_list.txt 

(^^ in a text file for later review ^^)

like image 188
Lou Grossi Avatar answered Oct 04 '22 04:10

Lou Grossi