Originally Posted by Rettahdam
I need to create a 50k and 200k file for testing
Tinkster's command is fine, but I would suggest an only slightly-modified version:
dd if=/dev/random of=50k_file bs=1024 count=50
The only difference is the use of /dev/random in place of /dev/zero. And the only reason I suggest that is because you want the file for testing.
Depending on the test, an all-zeroes file may not provide accurate results. For instance, compression algorithm tests would have an absolute field day "compressing" all zeroes.
So a random data file might be more to your liking.
And to be thorough, I don't know how truncate handles the data when a file is grown. The man page does not mention whether the new space is all-zeroes, randomized, or "whatever was written at those particular sectors last time they were used."