Sometimes we need to add a file with specific file size for testing the download speed etc..
For this you can create a file with specific size by following command:
Lets create a test file with specified size 100Kb. [root@server ~] # dd if=/dev/zero of=Testfile bs=1024 count=100
Where,
dd – dd is a common UNIX program whose primary purpose is convert and copy a file.
if – Input File. Read from FILE instead of stdin
of – Output File. write to FILE instead of stdout.(The name of the file to be created)
bs – Block Size, mostly in bytes.(Default value is 512bytes)
count – the size of the file to be created in KB
Now lets see if the file size is as specified
[root@server ~]# ls -l Testfile -rw-r–r– 1 root root 102400 Mar 18 06:31 Testfile
You could see the file of specific size will be created for you.