Re: Create files with specific sizes?

Eric Bambach
2004-12-16T01:14:07Z

On Tuesday 14 December 2004 02:52 am, Khan wrote:
> Hello,
>
> is there any way (some command) that will allow me to create blank files
> with specific sizes, eg 1MB, 5MB, 10MB etc.
>
> TNX

Just for the sake of chipping in...dd supports the K,M,GB suffixes so you
don't have to remember odd numbers (1024,2048,3096). You can just write
dd if=/dev/urandom of=/myfile bs=1M count=1
dd if=/dev/urandom of=/myfile bs=10M count=1
dd if=/dev/urandom of=/myfile bs=5M count=1
dd if=/dev/urandom of=/myfile bs=5G count=1 ;)

Manpage for DD:

The GNU fileutils-4.0 version also allows the
following multiplicative suffixes in the specification of blocksizes
(in bs=, cbs=, ibs=, obs=): M=1048576, G=1073741824, and so on for T,
P, E, Z, Y. A `D' suffix makes them decimal: kD=1000, MD=1000000,
GD=1000000000, etc. (Note that for ls, df, du the size of M etc. is
determined by environment variables, but for dd it is fixed.)

HTH!

--
----------------------------------------
--EB

> All is fine except that I can reliably "oops" it simply by trying to read
> from /proc/apm (e.g. cat /proc/apm).
> oops output and ksymoops-2.3.4 output is attached.
> Is there anything else I can contribute?

The latitude and longtitude of the bios writers current position, and
a ballistic missile.

--Alan Cox LKML-December 08,2000

----------------------------------------