快速生成大量随机大小的文件
# 在当前目录下,生成50W个大小0-8K的随机txt文件
time perl -E '
$n=shift;
$max_size=1024 * shift;
for(1..$n){
open $f, ">", "$_.txt" or die "open failed: $!";
print {$f} "0" x int(rand($max_size));
close $f or die "close failed: $!";
}
' 500000 8
real 0m8.073s
user 0m1.618s
sys 0m6.313s
Linux系列文章:https://www.cnblogs.com/f-ck-need-u/p/7048359.html
Shell系列文章:https://www.cnblogs.com/f-ck-need-u/p/7048359.html
网站架构系列文章:http://www.cnblogs.com/f-ck-need-u/p/7576137.html
MySQL/MariaDB系列文章:https://www.cnblogs.com/f-ck-need-u/p/7586194.html
Perl系列:https://www.cnblogs.com/f-ck-need-u/p/9512185.html
Go系列:https://www.cnblogs.com/f-ck-need-u/p/9832538.html
Python系列:https://www.cnblogs.com/f-ck-need-u/p/9832640.html
Ruby系列:https://www.cnblogs.com/f-ck-need-u/p/10805545.html
操作系统系列:https://www.cnblogs.com/f-ck-need-u/p/10481466.html
精通awk系列:https://www.cnblogs.com/f-ck-need-u/p/12688355.html