Thomas' Tech Tips

Generate a stream of ones

25 August 2023 - Thomas Damgaard

/dev/zero outputs a stream of binary zeros. This is often quite useful.

However, in some weird situation I needed a stream of binary 1s. This is how I did it:

$ cat /dev/zero |tr '\0' '\377'|hd
00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
Filed under: binary, howto, linux, shell, tips

Back to article list