Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to test an sftp host for its cutoff of file size upload limitation. I wanted to make a series of files that were of increasingly larger sizes, to try to upload them all and see where they failed.

I was doing for i in {10000..100000} ; do dd if=/dev/zero of=testfile$i bs=$i count=1 ; done ; but that was taking too long, and the files I was getting were starting at 10K, going to 11K, 12K, etc. I want the size to jump in larger increments.

How can a make a series of files that won't have such a fine-grained size difference? I'm thinking the limit is between 0 and 1 MB.

share|improve this question
up vote 4 down vote accepted

From dd(1):



BLOCKS and BYTES may be followed by the following multiplicative suffixes: c =1, w =2, b =512, kB =1000, K =1024, MB =1000*1000, M =1024*1024

Alternatively, if you have a recent version of bash, the {} construct also takes a step parameter:

for i in {10000..100000..1000}; do dd if=/dev/zero of=testfile$i bs=$i count=1 ; done
share|improve this answer

For academic purposes, this would give a command 1k input files in increments of 1024 bytes by appending to the same file.

while ((++n<=1024)); do
    printf '\0%.s' {1..1024} >&3
    xxd -g 1 /dev/stdin; echo # sftp command here
done <<<'' 3>/dev/stdin

But... trial and error? I'd find a better way.

share|improve this answer
If you're sure there's a better way I'm all ears :D – user394 Jul 2 '12 at 22:13
Have you checked, and it's actually the sftp server that's doing the enforcing? Why would there be a per-file limit? If there were such a thing it would probably be a filesystem or some other limit, in which case, ssh in and find how to query it. – ormaaj Jul 2 '12 at 22:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.