Server managers often encounter more than 250,000 of the number of files in the customer request to query which directories are larger than the number of files, such a customer pulic_html directory of subdirectories are generally good dozens of, the query is very difficult, if each directory runs a file Count command, it takes at least 30 minutes. The following method can quickly query the directory with a higher number of files.
Login to the corresponding SSH, execute the command:
#cd/home/username/public_html
#du-S | Sort-n #查询目录磁盘占用
#find. -printf "%i\n" | Sort-u | Wc–l #统计当前目录的文件数
or run directly:
#du-S/home/username/public_html/* | Sort-nr #查询目录磁盘占用
#find. -printf "%i\n" | Sort-u | Wc–l #统计当前目录的文件数
Depending on the directory disk consumption to determine the size of the directory files, only need to count the disk occupies a large directory can be, without traversing the query, you can save a lot of time. In addition count the number of files in the current directory can be ordered:
#find. | Grep-v \/$ | Wc-l substitution (personally feel relatively good to remember).
URL Address: http://www.bianceng.cn/Servers/zs/201602/49620.htm
This article is from the "Dudu Growth Diary" blog, please be sure to keep this source http://3402313.blog.51cto.com/3392313/687190