View and Display Linux Fedora Directory Tree using tree Command
View Fedora Linux Directory Tree Using tree command
The directory in Linux Fedora can be view by tree like format using the tree command. The example below show the use of tree command to display Linux Fedora directory in tree like format, the example below also show the use of tree command to display directory inode number and files inode number on Linux Fedora system.
tree command example:
1. The command below, use tree command to display and list only one level directory from the root directory:
|
[root@fedora ~]#
tree
-L 1 / |-- bin |-- boot |-- dev |-- etc |-- home |-- lib |-- lost+found |-- media |-- misc |-- mnt |-- net |-- opt |-- proc |-- root |-- samba-share |-- sbin |-- selinux |-- srv |-- sys |-- tmp |-- usr `-- var
22 directories, 0 files [root@fedora ~]#
|
|
2. The example below use the tree command to display and view the directory and directory inodes number in Linux Fedora.
|
[root@fedora ~]# tree -L 1 --inodes / / |-- [ 310689] bin |-- [ 2] boot |-- [ 219] dev |-- [ 384273] etc |-- [ 425153] home |-- [ 16353] lib |-- [ 11] lost+found |-- [ 179873] media |-- [ 318865] mnt |-- [ 515089] opt |-- [ 1] proc |-- [ 343393] root |-- [ 24530] sbin |-- [ 1] selinux |-- [ 392449] srv |-- [ 1] sys |-- [ 261633] tmp |-- [ 204401] usr `-- [ 408801] var
19 directories, 0 files [root@fedora ~]#
|
|
3. Display second level directory tree from the root directory, and pipe the output to less command
|
[root@fedora ~]# tree -L
2 / | less |-- bin | |-- alsacard | |-- alsaunmute | |-- arch | |-- awk -> gawk | |-- basename | |-- bash | |-- cat | |-- chgrp | |-- chmod | |-- chown | |-- cp ++++++++++++++ 408 directories, 950 files [root@fedora ~]#
|
|
4. List all directory and files under the specific directory, the example below show the use of tree command to display all directory file in current directory including hidden files and hidden directory
|
[root@fedora ~]# tree -a -L 1 ./ ./ |-- .ICEauthority |-- .bash_history |-- .bash_logout |-- .bash_profile |-- .bashrc |-- .config |-- .cshrc |-- .dbus |-- .esd_auth |-- .gconf |-- .gconfd |-- .gnome2 |-- .gnome2_private |-- .gstreamer-0.10 |-- .gtk-bookmarks |-- .gvfs |-- .local |-- .metacity |-- .mozilla |-- .nautilus |-- .pulse |-- .pulse-cookie |-- .recently-used.xbel |-- .redhat |-- .tcshrc |-- .thumbnails |-- .tomboy |-- .tomboy.log |-- .wapi |-- Desktop |-- Documents |-- Download |-- Music |-- Pictures |-- Public |-- Templates |-- Videos |-- anaconda-ks.cfg |-- fedora9 |-- install.log |-- install.log.syslog `-- mbox
26 directories, 16 files [root@fedora ~]#
Note: the (./) => for current directory, you can change this to list other directory. |
|
Get help for tree command.
[root@localhost ~]# tree --help
usage: tree [-adfgilnpqrstuxACDFNS] [-H baseHREF] [-T title ] [-L
level [-R]]
[-P pattern] [-I pattern] [-o filename] [--version] [--help] [--inodes]
[--device] [--noreport] [--nolinks] [--dirsfirst] [--charset charset]
[<directory list>]
-a All files are listed.
-d List directories only.
-l Follow symbolic links like directories.
-f Print the full path prefix for each file.
-i Don't print indentation lines.
-q Print non-printable characters as '?'.
-N Print non-printable characters as is.
-p Print the protections for each file.
-u Displays file owner or UID number.
-g Displays file group owner or GID number.
-s Print the size in bytes of each file.
-D Print the date of last modification.
-F Appends '/', '=', '*', or '|' as per ls -F.
-r Sort files in reverse alphanumeric order.
-t Sort files by last modification time.
-x Stay on current filesystem only.
-L level Descend only level directories deep.
-A Print ANSI lines graphic indentation lines.
-S Print with ASCII graphics indentation lines.
-n Turn colorization off always (-C overrides).
-C Turn colorization on always.
-P pattern List only those files that match the pattern given.
-I pattern Do not list files that match the given pattern.
-H baseHREF Prints out HTML format with baseHREF as top directory.
-T string Replace the default HTML title and H1 header with string.
-R Rerun tree when max dir level reached.
-o file Output to file instead of stdout.
--inodes Print inode number of each file.
--device Print device ID number to which each file belongs.
--noreport Turn off file/directory count at end of tree listing.
--nolinks Turn off hyperlinks in HTML output.
--dirsfirst List directories before files.
--charset X Use charset X for HTML and indentation line output.
[root@localhost ~]#
Keywords: tree command, linux directory tree, fedora directory tree, directory inode, file inode, display directory tree, directory tree, filesysystem directory tree
- Add new comment
- 10474 reads
- Email this page
Thanks for Reading and Check Other Popular Linux Topics
All time:
- Configure and Setup Squid Cache Proxy Server on Fedora Core.
- Using Linux rm command to delete, remove hidden files and folder - Basic Linux Command.
- Copy Linux Files and Copy Directory Using cp Command - Linux Basic Command.
- Moving or rename files and directory using Linux mv command - Basic Linux Command.
- Add, view, edit and configure route and static route on Linux Fedora Core - Linux Server Configuration.
- Get and display the size of file and directory in Linux system using du command.
- Step by step Install Setup and Configure Linux Fedora Core Server and Network Management with Screen Shot and Example.
- Create file and display file contents in Linux using cat command.
- Configure Squid to block HTTP request to specific web sites.
- Example of samba smbpasswd file and samba smbusers configuration file.





1 comment
I really wanted to develop a
Submitted by Marin1987 (not verified) on Wed, 09/05/2012 - 09:54.I really wanted to develop a small remark to say thanks to www.labtestproject.com for some of the amazing recommendations you are writing at this website. My considerable internet look up has at the end been recognized with brilliant suggestions to exchange with my guests. I would assert that we site visitors actually are quite lucky to exist in a wonderful community with so many outstanding people with very beneficial principles. I feel very much fortunate to have used your entire webpage and look forward to many more brilliant times reading here. Thanks once again for all the details.