Monday, 15 July 2019

How to create a random .txt(Human readable text like ascii) file in linux


I need to create a text file which should contain random text data that can be read by human. I know that we can use /dev/urandom and /dev/random for getting random data. But it is not readable by humans. I need to create a file which contains random text format. Is there any way to do that?



Answer



We can do it by following command


base64 /dev/urandom | head -c 10000000 > file.txt

It creates a file with name file.txt size of 10 MB.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...