This experience is done under CentOS release 6.7 (Final): View directory with ls command/var display: # Ls/var/account crash db Games local log NIS preserve SP Ool ypcache CVs empty lib lock mail opt run tmp for a more intuitive display of the file directory, we use the tree command to display:
# yum install treeloaded plugins: fastestmirror, securitysetting up install processbase | 3.7 kb 00:00 base/primary_db | 4.7 MB 02:22 extras | 3.4 kB 00:00 extras/primary_db | 37 kb 00:00 updates | 3.4 kB 00:00 updates/primary_db | 89 kb 00:01 resolving dependencies--> running transaction check---> Package tree.x86_64 0:1.5.3-3.el6 will be installed--> finished dependency resolutiondependencies resolved=============================================================================== package Arch Version repository size============================== =================================================installing: tree x86_64 1.5.3-3.el6 base 36 ktransaction summary========================================= ======================================install 1 package (s) total &NBSP;DOWNLOAD&NBSP;SIZE:&NBSP;36&NBSP;KINSTALLED&NBSP;SIZE:&NBSP;65&NBSP;KIS&NBSP;THIS&NBSP;OK&NBSP;[Y/N]: yDownloading Packages:tree-1.5.3-3.el6.x86_64.rpm | 36 kB 00:00 Warning: rpmts_hdrfromfdno:&nBsp Header v3 rsa/sha1 signature, key id c105b9de: nokeyretrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6Importing GPG key 0xC105B9DE: userid : centos-6 key (Centos 6 official signing key) <[email protected]> Package: centos-release-6-7.el6.centos.12.3.x86_64 (@ anaconda-centos-201508042137.x86_64/6.7) from : /etc/pki/rpm-gpg/ rpm-gpg-key-centos-6is this ok [y/n]: yrunning rpm_check_debugrunning transaction testtransaction test succeededrunning transaction installing : tree-1.5.3-3.el6.x86_64 1/1 verifying : tree-1.5.3-3.el6.x86_64 1/1 installed: tree.x86_64 0:1.5.3-3.el6 complete!
The tree command is installed!
Displays the first-level directories and files for the/var directory:
# tree-l 1/var/vara "A" a "AccountA" a "a" Cachea "a" a "Crasha" a "a" CVSA "a" a "DBA" a "a" Emptya "a" a "Gamesa" a "a" Liba "a" a "loca La "A" a "Locka" a "a" Loga "a" a "mail-Spool/maila" a "a" Nisa "a" a "Opta" a "a" Preservea "a" a "Runa" a "a" Spoola "a" a "" Tmpa "" a " "A" YP
Directories, 0 files
Display garbled, garbled reason is: the current user's environment lang variable and CRT character encoding is not consistent.
The Linux character set view:
# echo $LANGen _us. UTF-8
Set the CRT's CharSet to UTF-8:
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/82/10/wKiom1dJqMbhXF8ZAADffYtZtKk585.jpg-wh_500x0-wm_3 -wmp_4-s_1400922096.jpg "title=" 1.JPG "alt=" Wkiom1djqmbhxf8zaadffytztkk585.jpg-wh_50 "/>
Displays the first-level directories and files of the/var directory: normal
# tree-l 1/var/var├──account├──cache├──crash├──cvs├──db├──empty├──games├──lib├──local├──lock├──log├──mail- > spool/mail├──nis├──opt├──preserve├──run├──spool├──tmp└──yp19 directories, 0 files
Tree's system Help:
# tree --helpusage: tree [-adfghilnpqrstuvxacdfns] [-h basehref] [-t Title ] [-l level [-r]] [-p pattern] [-I pattern] [-o filename] [--version] [--help] [--inodes] [--device] [--noreport] [--nolinks] [--dirsfirst] [-- Charset charset] [--filelimit #] [<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. -h print the size in a more human readable way. -d Print the date of last Modification. -f appends '/', ' = ', ' * ', or ' | ' as per ls -F. -v Sort files alphanumerically by version. -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. -- filelimit # do not descend dirs with more than # files In them.
This article is from the "evil" blog, make sure to keep this source http://evil001.blog.51cto.com/911643/1784146
Linux tree command trees display file directory structure and handle CRT display garbled problem