Quote from Using BSD jotMost every Linux system comes with GNU seq (a utility to generate  sequences of numbers or characters). However, a much older utility   and more flexible one  is the underutilized and unknown utility, jot.  Every BSD system, including MacOS X, will come with jot (and not with  seq).(...)In fact, to generate a large file (5Gb in this case), try this:jot -r -c -s '' $(( 1024 * 1024 * 5 )) > file.5gbWhen I try this out it generates a 5 MB file.jot -r -c -s '' $(( 1024 * 1024 * 5 )) > file.5gbdu -sh file.5gb5.0M    file.5gbWhat does this command exactly do? How to specify size, for example 2 GB file? Is this the recommended way to generate random content files on macOS? Do you use other tools for random content files?seq can't generate random content. Is this correct?
Using BSD jot for generating file with random content
shell;osx;bsd;random;seq
The example is slightly wrong and the result is correct. Let me explain.The $(( 1024 * 1024 * 5 )) is simply a sum, but it will only work under the sh shell environment. For example:shecho $(( 1024 * 1024 * 5))5242880That part sorted, back to jot. The -r is for random data and that should be what you find in the file.The -c is shorthand for, and the same as using -w %c. While I'm not exactly sure what %c means, it does seem to produce a single byte of random data. You could swap out the -c for -b x and you would get the same size file but it would contain just the x repeated.Next is -s '' which means no line returns. Without this there would be a line return after each character (or random data). Your file should also be twice as big.The next part is $(( 1024 * 1024 * 5 )). This is the amount of data to produce. As shown above, that sum makes the number 5242880 (which is only 5MiB) and that is how large the file will be plus 1 byte for the trailing line return. For example:shjot -r -c -s '' $(( 1024 * 1024 * 5 )) > file.5mbls -al file.5mb-rw-r--r--  1 tigger  tigger  5242881  2 Apr 15:39 file.5mb