最近在linux下做一个测试,需要几个百兆的空文件,以前见过别人用Perl脚本做过,如果在windows平台下,Perl将是一个好的选择,不过在Linux/Unix平台下我们还可以通过dd命令来产生。
例如:
如果要产生一个100M的文件:
[oracle@rac1 ~]$ dd if=/dev/zero of=1.ora bs=1024 count=102400
102400+0 records in
102400+0 records out
[oracle@rac1 ~]$ ls -lh
total 101M
-rw-r--r-- 1 oracle dba 100M Aug 8 12:26 1.ora
-rw-r--r-- 1 oracle dba 69 Jul 27 12:04 afiedt.buf
drwxr-xr-x 3 oracle dba 4.0K Jul 17 20:28 dba
drwxr-xr-x 2 oracle dba 4.0K Jun 18 13:49 Desktop
-rwxr-x--x 1 oracle dba 39 Jun 21 22:15 hello.py
-rw-r--r-- 1 oracle dba 1.1K Jul 20 02:12 rac1.ora
-rw-r--r-- 1 oracle dba 729K Jun 20 13:52 upgrade.log
非常方便。[@more@]