A detailed run down of one command mentioned from one linux tips link posted here, was the linux command tree.
Man says:
Tree is a recursive directory listing program that produces a depth indented listing of files. Color is supported ala dircolors if the LS_COLORS environment variable is set, output is to a tty, and the -C flag is used. With no arguments, tree lists the files in the current directory. When directory arguments are given, tree lists all the files and/or directories found in the given directories each in turn. Upon completion of listing all files/directories found, tree returns the total number of files and/or directories listed.
This is a handy little utility to display tree view of directories. An overview of how files and directories are expanded and traversed can be misleading and confusing when we are referring to thousand of files and folders. Tree comes as a handy tool to peruse those deep directory tree structures and files, especially when someone is trying to hide something from you.
With my fresh virtual Fedora 7 box, I have managed to count all directories and display them in tree view from it. By default installation, Fedora has more than 11,600 directory folders.
INSTALLATION
====================
In case, tree is not installed from your current Fedora box, here's a quick yum install howto# yum -y install tree
TREE USAGE
====================
Here are more parameter sample using Tree
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To display files and directories in a tree view mode# tree
To display directories only would be like# tree -d
Sample output:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|-- [apache apache ] ./LICENSE.txt
|-- [apache apache ] ./_install.php
|-- [apache apache ] ./_upgrade.php
|-- [apache apache ] ./admin
| |-- [apache apache ] ./admin/index.php
| |-- [apache apache ] ./admin/js
| | |-- [apache apache ] ./admin/js/AmiJS.js
| | |-- [apache apache ] ./admin/js/ajax_editing.js
| | |-- [apache apache ] ./admin/js/greybox.js
| | |-- [apache apache ] ./admin/js/lightbox.js
| | |-- [apache apache ] ./admin/js/plogger.js
| | `-- [apache apache ] ./admin/js/prototype.js
| |-- [apache apache ] ./admin/plog-admin-functions.php
| |-- [apache apache ] ./admin/plog-admin.php
| |-- [apache apache ] ./admin/plog-feedback.php
| |-- [apache apache ] ./admin/plog-import.php
| |-- [apache apache ] ./admin/plog-manage.php
| |-- [apache apache ] ./admin/plog-options.php
| |-- [apache apache ] ./admin/plog-rpc.php
| |-- [apache apache ] ./admin/plog-themes.php
| |-- [apache apache ] ./admin/plog-thumb.php
| |-- [apache apache ] ./admin/plog-thumbpopup.php
| `-- [apache apache ] ./admin/plog-upload.php
|-- [apache apache ] ./captcha.ttf
|-- [apache apache ] ./css
| |-- [apache apache ] ./css/admin.css
| |-- [apache apache ] ./css/gallery.css
| |-- [apache apache ] ./css/greybox.css
| |-- [apache apache ] ./css/lightbox.css
| `-- [apache apache ] ./css/tabs.css
|-- [apache apache ] ./dynamics.js
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To view and display every file and folders including hidden ones in a tree mode display would be
# tree -a
To view files with UID, GUID, filesize, file location would be like so# tree -ugfs
Sorted view of tree display is also possible by using tree parameters like
reversed sorting order# tree -ugfsr
sorted by modification time# tree -ugfst
To view and display all files and directories with UID and GID# tree -gd
To use tree with enabled colorization would be# tree -C
You can notice that using tree parameters, you can search files in a tree view mode of display using tree from command line terminal. Remember that these results can be combined further using other linux command.
Using linux command tree combined with grep would create another alternative way on grep'ing all files that has a modification time stamp of this month, September.# tree -D | grep Sep
Alternatively, using tree to search or files and folder owned by a particular user or group ID like so# tree -ugf | grep 'root\|user1'
Since tree traverses director folder, the depth of directory tree can also be specified like so# tree -L 2
which traverses 2nd level down directories.
Another nice feature of tree linux command is that it can generate output in HTML file format with reference to base. This is done like so# tree -H 'http://yourhost.domain.com' > index.html
Here's a sample of the generated tree view in web page file format:
Here's a sample screenshot of tree output from command line:
Enjoy.
Subscription
Categories
- HowTos (612)
- Linux Devices (40)
- Linux Diggs (620)
- Linux News (1541)
- Linux Videos (24)
Recent Posts
Blog Archive
-
▼
2007
(340)
-
▼
September
(58)
- Dear Linux SysAd Blog Readers
- Proactive monitoring from linux terminal
- deleting new lines and return line from text file
- Google chat setup using PSI howto
- PSI messenger - a truly promising open messaging a...
- Google chat setup using GAIM Pidgin howto
- Linux command line shell variables defined
- ls - displaying directory contents in many ways
- Control of alternative linux executables
- Searching using whereis linux command
- Witchy which linux command
- NeroLinux - diehard Nero burning software
- Google Sky - Explore and Rediscover the Sky
- Celestia - 3D Earth and Sky visualization
- Earth3D - real-time 3D Earth visualization
- GcStar - managing personal collection items
- DStat - resource statistics linux tool
- Bandwidth Monitor-NG - terminal-based interface ba...
- KNemo - KDE network interface monitoring tool
- EtherApe - graphical network activity monitoring tool
- Beauty of Math using Linux
- print leading/trailing lines before/after a matchi...
- Nagios Monitoring - install and generic setup howto
- ChRT- change real-time attribute process scheduling
- squeezed out multiple commented lines
- UNIX to DOS text file format converter
- totally squeezed out multiple blank lines
- squeezed multiple blank lines into single line
- fmt - simple optimal text formatter
- Linux backup powered by RDiff-Backup
- Linux Ping command explained
- read and display text file from terminal
- URLView - URL and email extractor
- TFTP server - setup and install howto
- NMap - Linux port scanning
- removing garbage characters from screen terminal
- invert string match using grep
- RDesktop - remote desktop howto
- Graveman on Linux - burn baby burn burn
- HTOP - interactive process viewer alternative
- Caching DNS server install howto
- BitTorrent - downloading large files made easy
- PHPAlbum - web photo album install howto
- MRTG graph creation with Cisco routers
- Tree view of directories and file listings from co...
- MAC address packet filtering using IPTables
- GTK-based GNOME Linux Tools
- Linux backups powered by RSnapShot
- MRTG tutorial, install and howtos
- FindSMB - view shared folders from network
- Squid - upgrade and install howto
- prompt and press a key between script lines
- Devede - DVD/VCD video authoring and creation tool
- display file and file system status
- determine file type
- GNOME GUI task scheduler install howto
- Linux backups powered by Rsync
- KPackage - GUI package administration and manageme...
-
▼
September
(58)
Wednesday, September 5, 2007
Tree view of directories and file listings from command line
Subscribe to:
Post Comments (Atom)
ILoveTux - howtos and news | About | Contact | TOS | Policy
0 comments:
Post a Comment