Generate random files

27 || 0  || 2018-04-18 12:05:05 || root || || Bash

The command below will create 1000 files with random content and size between 500Kb and 25Mb

Parameters:

  • -w 1 1000 - number of files
  • of=file_%.log - filename
  • -i51200-2621440 - minimum and maximum size of files. Actual size will be multiplied by value of count (10 in our case)

seq -w 1 1000 | xargs -n1 -I% sh -c 'dd if=/dev/urandom of=file_%.log bs=$(shuf -i51200-2621440 -n1) count=10'