<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: How To Quickly Generate A Large File On The Command Line (With Linux)</title> <atom:link href="http://www.skorks.com/2010/03/how-to-quickly-generate-a-large-file-on-the-command-line-with-linux/feed/" rel="self" type="application/rss+xml" /><link>http://www.skorks.com/2010/03/how-to-quickly-generate-a-large-file-on-the-command-line-with-linux/</link> <description>For the betterment of the software craft...</description> <lastBuildDate>Mon, 21 Nov 2011 13:57:06 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.1.2</generator> <item><title>By: Puneet Madaan</title><link>http://www.skorks.com/2010/03/how-to-quickly-generate-a-large-file-on-the-command-line-with-linux/comment-page-1/#comment-7606</link> <dc:creator>Puneet Madaan</dc:creator> <pubDate>Mon, 07 Nov 2011 13:37:34 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1538#comment-7606</guid> <description>Though I was seeking some neat interface, rather then popen dd to handle my swapfile in chroot... and hadn&#039;t been able to find a neater solution, then one already existng.. yet I think you can make the process of file creation even faster, as you really do not need dd to write blocks, its such a wastage of time in majority of cases..
if contents does not matter, then seek is better then write operation (considering  faster operation with lesser Hardidsk noise polution :p )...   anyways GB big files are usually diskimage (my assumption, in my case it was swapfile), which later are formated using mk-blabla file-system structure... thus
dd  if=/dev/zero of=somefile  bs=1 seek=1G  count=0
Greetingz</description> <content:encoded><![CDATA[<p>Though I was seeking some neat interface, rather then popen dd to handle my swapfile in chroot&#8230; and hadn&#8217;t been able to find a neater solution, then one already existng.. yet I think you can make the process of file creation even faster, as you really do not need dd to write blocks, its such a wastage of time in majority of cases..</p><p>if contents does not matter, then seek is better then write operation (considering  faster operation with lesser Hardidsk noise polution :p )&#8230;   anyways GB big files are usually diskimage (my assumption, in my case it was swapfile), which later are formated using mk-blabla file-system structure&#8230; thus</p><p>dd  if=/dev/zero of=somefile  bs=1 seek=1G  count=0</p><p>Greetingz</p> ]]></content:encoded> </item> <item><title>By: Larry</title><link>http://www.skorks.com/2010/03/how-to-quickly-generate-a-large-file-on-the-command-line-with-linux/comment-page-1/#comment-7521</link> <dc:creator>Larry</dc:creator> <pubDate>Sat, 08 Oct 2011 04:17:25 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1538#comment-7521</guid> <description>I&#039;m surprised nobody caught this.  The dd command is not blazingly fast.  In fact, it is very limited to the IO speed of your disk.  The reason why creating a 1GB file took only a second is because if dirtied your cache buffers which are kept in memory.  Assuming that you had 4GB RAM and a normal SATA disk (circa March 2010), a DD of a 50 GB file would have taken you about about 15 1/2 minutes, not 50 seconds as might be implied.  Had you had only 256MB on RAM in your system, the DD of a 1GB file would have probably taken about 20 seconds.</description> <content:encoded><![CDATA[<p>I&#8217;m surprised nobody caught this.  The dd command is not blazingly fast.  In fact, it is very limited to the IO speed of your disk.  The reason why creating a 1GB file took only a second is because if dirtied your cache buffers which are kept in memory.  Assuming that you had 4GB RAM and a normal SATA disk (circa March 2010), a DD of a 50 GB file would have taken you about about 15 1/2 minutes, not 50 seconds as might be implied.  Had you had only 256MB on RAM in your system, the DD of a 1GB file would have probably taken about 20 seconds.</p> ]]></content:encoded> </item> <item><title>By: sdaau</title><link>http://www.skorks.com/2010/03/how-to-quickly-generate-a-large-file-on-the-command-line-with-linux/comment-page-1/#comment-6692</link> <dc:creator>sdaau</dc:creator> <pubDate>Tue, 23 Nov 2010 20:08:58 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1538#comment-6692</guid> <description>Sorry for another bump - here is a slightly changed version, which is a true one-liner in Python, by using square brackets and inverting the order of the &lt;code&gt;for&lt;/code&gt; and the &lt;code&gt;write&lt;/code&gt; command:
&lt;pre&gt;python -c &#039;import sys; a1=&quot;abcdefghijklmnopqrstuvwxyz&quot; ; a2=a1[::-1] ; a=a1+a2[1:] ; size=100000 ; [sys.stdout.write(a) for i in range(1,size,len(a))]&#039; # &gt; myfile.dat&lt;/pre&gt;
Cheers!</description> <content:encoded><![CDATA[<p>Sorry for another bump &#8211; here is a slightly changed version, which is a true one-liner in Python, by using square brackets and inverting the order of the <code>for</code> and the <code>write</code> command:</p><pre>python -c 'import sys; a1="abcdefghijklmnopqrstuvwxyz" ; a2=a1[::-1] ; a=a1+a2[1:] ; size=100000 ; [sys.stdout.write(a) for i in range(1,size,len(a))]' # &gt; myfile.dat</pre><p>Cheers!</p> ]]></content:encoded> </item> <item><title>By: sdaau</title><link>http://www.skorks.com/2010/03/how-to-quickly-generate-a-large-file-on-the-command-line-with-linux/comment-page-1/#comment-6652</link> <dc:creator>sdaau</dc:creator> <pubDate>Mon, 08 Nov 2010 23:12:06 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1538#comment-6652</guid> <description>Ups...  just to note - the &quot;for&quot; needs to be on its own line, the linebreak seems to be eaten by the pre tag.. Please either add this note to prev post, or remove &#039;pre&#039; tag from previous post - and delete this post  - thanks!</description> <content:encoded><![CDATA[<p>Ups&#8230;  just to note &#8211; the &#8220;for&#8221; needs to be on its own line, the linebreak seems to be eaten by the pre tag.. Please either add this note to prev post, or remove &#8216;pre&#8217; tag from previous post &#8211; and delete this post  &#8211; thanks!</p> ]]></content:encoded> </item> <item><title>By: sdaau</title><link>http://www.skorks.com/2010/03/how-to-quickly-generate-a-large-file-on-the-command-line-with-linux/comment-page-1/#comment-6651</link> <dc:creator>sdaau</dc:creator> <pubDate>Mon, 08 Nov 2010 23:10:14 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1538#comment-6651</guid> <description>Hi - thanks for the great post! My snippet: given a string append its reversed version, and keep on outputting this - using Python (bash syntax here):
&lt;pre&gt;
python -c &#039;import sys; a1=&quot;abcdefghijklmnopqrstuvwxyz&quot; ; a2=a1[::-1] ; a=a1+a2[1:] ; size=100000 ; for i in range(1,size,len(a)): sys.stdout.write(a)&#039; # &gt; myfile.dat
&lt;/pre&gt;
Cheers!</description> <content:encoded><![CDATA[<p>Hi &#8211; thanks for the great post! My snippet: given a string append its reversed version, and keep on outputting this &#8211; using Python (bash syntax here):</p><pre>
python -c 'import sys; a1="abcdefghijklmnopqrstuvwxyz" ; a2=a1[::-1] ; a=a1+a2[1:] ; size=100000 ; for i in range(1,size,len(a)): sys.stdout.write(a)' # &gt; myfile.dat
</pre><p>Cheers!</p> ]]></content:encoded> </item> <item><title>By: Vasudev Ram</title><link>http://www.skorks.com/2010/03/how-to-quickly-generate-a-large-file-on-the-command-line-with-linux/comment-page-1/#comment-4573</link> <dc:creator>Vasudev Ram</dc:creator> <pubDate>Fri, 09 Apr 2010 23:25:22 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1538#comment-4573</guid> <description>And related to the above, a shorter way of writing an infinite while loop in the shell, is, instead of this:
while true
do
# commands
done
to use this:
while :
do
# commands
done
Works for the same reason as stated in my previous comment above; the : (colon) command is a do-nothing (shell built-in) command that returns true as its exit code, but is faster to run than the &quot;true&quot; command that does the same, but &quot;true&quot; is an actual binary (executable file) on disk, and hence (except for caching) has to be loaded into memory each time through the while loop, leading to a small overhead.
- Vasudev</description> <content:encoded><![CDATA[<p>And related to the above, a shorter way of writing an infinite while loop in the shell, is, instead of this:</p><p>while true<br
/> do<br
/> # commands<br
/> done</p><p>to use this:</p><p>while :<br
/> do<br
/> # commands<br
/> done</p><p>Works for the same reason as stated in my previous comment above; the : (colon) command is a do-nothing (shell built-in) command that returns true as its exit code, but is faster to run than the &#8220;true&#8221; command that does the same, but &#8220;true&#8221; is an actual binary (executable file) on disk, and hence (except for caching) has to be loaded into memory each time through the while loop, leading to a small overhead.</p><p>- Vasudev</p> ]]></content:encoded> </item> <item><title>By: Vasudev Ram</title><link>http://www.skorks.com/2010/03/how-to-quickly-generate-a-large-file-on-the-command-line-with-linux/comment-page-1/#comment-4572</link> <dc:creator>Vasudev Ram</dc:creator> <pubDate>Fri, 09 Apr 2010 23:19:43 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1538#comment-4572</guid> <description>@ jon and alan:
Smiley of death is a nice term, hadn&#039;t come across it before.
In that, the colon is a do-nothing command (that returns true, BTW) and the rest of the line is the redirection. But even that can be made shorter - although by just 1 character :) , just use:
&gt; file.txt
Odd though it may seem, that&#039;s a legal shell command.
Thinking mathematically, one could say that &quot;a zero-length or null command is also a command&quot; :), so the shell allows it ...
- Vasudev</description> <content:encoded><![CDATA[<p>@ jon and alan:</p><p>Smiley of death is a nice term, hadn&#8217;t come across it before.</p><p>In that, the colon is a do-nothing command (that returns true, BTW) and the rest of the line is the redirection. But even that can be made shorter &#8211; although by just 1 character :) , just use:</p><p>&gt; file.txt</p><p>Odd though it may seem, that&#8217;s a legal shell command.</p><p>Thinking mathematically, one could say that &#8220;a zero-length or null command is also a command&#8221; :), so the shell allows it &#8230;</p><p>- Vasudev</p> ]]></content:encoded> </item> <item><title>By: Alan Skorkin</title><link>http://www.skorks.com/2010/03/how-to-quickly-generate-a-large-file-on-the-command-line-with-linux/comment-page-1/#comment-4177</link> <dc:creator>Alan Skorkin</dc:creator> <pubDate>Tue, 23 Mar 2010 00:24:41 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1538#comment-4177</guid> <description>Hey Peter, I was hoping someone would share some windows ways to do this, thanks.</description> <content:encoded><![CDATA[<p>Hey Peter, I was hoping someone would share some windows ways to do this, thanks.</p> ]]></content:encoded> </item> <item><title>By: Peter</title><link>http://www.skorks.com/2010/03/how-to-quickly-generate-a-large-file-on-the-command-line-with-linux/comment-page-1/#comment-4176</link> <dc:creator>Peter</dc:creator> <pubDate>Tue, 23 Mar 2010 00:12:37 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1538#comment-4176</guid> <description>On Windows, use
fsutil file createnew &quot;desired_file_name&quot; file_size</description> <content:encoded><![CDATA[<p>On Windows, use<br
/> fsutil file createnew &#8220;desired_file_name&#8221; file_size</p> ]]></content:encoded> </item> <item><title>By: Alan Skorkin</title><link>http://www.skorks.com/2010/03/how-to-quickly-generate-a-large-file-on-the-command-line-with-linux/comment-page-1/#comment-4171</link> <dc:creator>Alan Skorkin</dc:creator> <pubDate>Mon, 22 Mar 2010 13:28:24 +0000</pubDate> <guid
isPermaLink="false">http://www.skorks.com/?p=1538#comment-4171</guid> <description>Hehe, smiley of death - I like it, thanks for sharing that.</description> <content:encoded><![CDATA[<p>Hehe, smiley of death &#8211; I like it, thanks for sharing that.</p> ]]></content:encoded> </item> </channel> </rss>
