Create a file of a specific size with random printable strings in bash

后端 未结 6 791
陌清茗
陌清茗 2021-01-13 22:27

I want to create a file of a specific size containing only printable strings in bash.

My first thought was to use /dev/urandom:

dd if=/d         


        
6条回答
  •  一整个雨季
    2021-01-13 22:32

    Quick and dirty bash solution

    Based on your request, using string on urandom

    dd if=<(strings 

    .. or even

    dd bs=4K count=25600 if=/dev/urandom |
        tr \\000-\\037\\200-\\377 \\040-\\077\\040-\\077\\040-\\140 >/tmp/file
    

提交回复
热议问题