Thursday, April 7, 2022

[SOLVED] How do I get an equivalent of /dev/one in Linux

Issue

You can use

dd if=/dev/zero of=file count=1024 bs=1024 

to zero fill a file.

Instead of that I want to one fill a file. How do I do that?

There is no /dev/one file, so how can I simulate that effect via on bash shell?


Solution

Try this:

dd if=<(yes $'\01' | tr -d "\n") of=file count=1024 bs=1024

Substitute $'\377' or $'\xFF' if you want all the bits to be ones.



Answered By - Dennis Williamson
Answer Checked By - David Marino (WPSolving Volunteer)