pikesaku’s blog

個人的な勉強メモです。記載内容について一切の責任は持ちません。

shellでランダムな16進数文字列を得るコマンド

コマンド

512MBのファイルを作る時

openssl rand -hex `expr 1024 \* 1024 \* 512 / 2` -out /tmp/512.mb.file

➗2が必要。
 
256MBの複数行で出力したい場合

openssl rand -base64 `expr 1024 \* 1024 \* 256` | head -c`expr 1024 \* 1024 \* 256` > /tmp/256.mb.file