This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Friday, December 8, 2017

Tree command in Linux Brief Explaination

Tree command is used to recursively check the number of files in folder.

tree - list contents of directories in a tree-like format

Tree is a recursive directory listing program that produces a depth indented listing of files. 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.

[root@testserver nsk]# tree -iLf 1 /home/nsk/
/home/nsk/
/home/nsk//audit.txt
/home/nsk//audit1.txt
/home/nsk//auditprod.txt
/home/nsk//auditprod1.txt
/home/nsk//dom
/home/nsk//ser.txt
/home/nsk//serv.txt
/home/nsk//serv1.txt
/home/nsk//server.txt
/home/nsk//umount
/home/nsk//umount-ser
/home/nsk//umount-ser1

0 directories, 12 files

Where:
    -i   Makes tree not print the indentation lines, useful when used in conjunction with the -f option.
    -L level Max display depth of the directory tree.

No comments:

Post a Comment