Generate large files in Unix ad hoc

A neat trick to generate large files ad hoc is to run one of the simplest Unix commands ever: yes. When executed, it regurgitates an infinite stream of ys (suffixed with newlines): $ yes y y y y ... Piping its output into a file for approximately 10 seconds on a Mac Mini (M1, 2020) yields an 18-GB file containing 9.6 billion lines! $ yes >> yes.log ^C $ ls -lh total 37664520 -rw-r--r-- 1 abdelrahman staff 18G Dec 28 17:16 yes....

December 28, 2022 · 1 min · Abdelrahman Abdelhafez