ติดตั้ง tree
# yum install tree #RHEL/CentOS 7
# dnf install tree #Fedora 22+ and /RHEL/CentOS 8
$ sudo apt install tree #Ubuntu/Debian
# sudo zypper in tree #openSUSE
ตรวจสอบการติดตั้ง
$ tree --version
tree v1.7.0 (c) 1996 - 2014 by Steve Baker, Thomas Moore, Francesc Rocher, Florian Sesser, Kyosuke Tokoro
การใช้งาน tree
แสดง file และ directory
# tree
OR
$ sudo tree
แสดงขนาดไฟล์ แบบอ่านง่ายๆ
$ sudo tree -h
แสดง hidden files
$ sudo tree -a
To list the directory contents with the full path prefix for each sub-directory and file
$ sudo tree -f
แสดงเฉพาะ directory (ไม่แสดง file)
$ sudo tree -d
To display only those files that match the wild-card pattern (ใช้ค้นหาไฟล์ได้)
$ sudo tree -P jack*
To prune empty directories from the output
$ sudo tree --prune
To prints the file type and permissions
$ sudo tree -p
แสดง username และ group name
$ sudo tree -pug
OR
$ sudo tree -pug -h
To display the date of the last modification time for each sub-directory or file
$ sudo tree -pug -h -D
To send or redirect the tree’s output to filename for later analysis
$ sudo tree -o direc_tree.txt