Linux View the number of subfolders and files

Source: Internet
Author: User

Find command View (recommended):

Number of subdirectories:

[[email protected] ~]# findAfish-type D | Wc-l
158
[[email protected] ~]# findafish/-type D | Wc-l
158
[[email protected] ~]# findafish/*-type D | Wc-l
157--Correct

Results for different reasons:
[[email protected] ~]# findAfish-type D | More
Afish-first line of output results
[[email protected] ~]# findafish/*-type D | More
Afish/examples-first line of output results

Summary: Use afish/* does not contain the parent directory of Afish, only the subdirectories below it.

Number of all files:

[[email protected] ~]# findAfish-type F | Wc-l
981
[[email protected] ~]# findafish/-type F | Wc-l
981
[[email protected] ~]# findafish/*-type F | Wc-l
981

Tree command view (not recommended):

[Email protected] ~]# treeAfish
......
157 directories, 978 files
-----------------------------------------
[Email protected] ~]# treeafish/
......
157 directories, 978 files

Du command view:

[Email protected] ~]# Du-ahafish/*| Wc-l
1138

Summary: du views The result is 1138, the number of subdirectories is 157, the number of files is: 1138-157=981, so the tree command to view the results should be inaccurate, as far as the calculation of which file, no longer check the problem, we recommend the Find command to view.

Linux View the number of subfolders and files

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.