Sometimes we require some random file of some specific size for testing some performance such as file transfer. There are several ways to create such files.
Method 1
If you just want a file with some specific size, you can use the following command.
dd if=/dev/urandom of=dummyfile.txt bs=2G count=1
The bs is the block size, 2G means 2 GB. If you make the count as 2, then 2 GB *2 = 4 GB random file will be generated.
Method 2
If you are concerned about the schema, you can generate the data using a simple approach.
First create a file with a sample data set of 1 or 2 records in a file. Let us call that file name as A.txt
Then using a simple shell script, we can make it very big.
Depending upon the size requirement, you can increase the value of limit to any number.
Method 3
Use any online / offline data generation tools. This will be required only if you need random data with some specific schema and discrete values.
Some useful links are listed below
1) http://www.generatedata.com/
2) http://c2.com/cgi/wiki?TestDataGenerator
Method 1
If you just want a file with some specific size, you can use the following command.
dd if=/dev/urandom of=dummyfile.txt bs=2G count=1
The bs is the block size, 2G means 2 GB. If you make the count as 2, then 2 GB *2 = 4 GB random file will be generated.
Method 2
If you are concerned about the schema, you can generate the data using a simple approach.
First create a file with a sample data set of 1 or 2 records in a file. Let us call that file name as A.txt
Then using a simple shell script, we can make it very big.
Depending upon the size requirement, you can increase the value of limit to any number.
Method 3
Use any online / offline data generation tools. This will be required only if you need random data with some specific schema and discrete values.
Some useful links are listed below
1) http://www.generatedata.com/
2) http://c2.com/cgi/wiki?TestDataGenerator
No comments:
Post a Comment