{"id":65766,"date":"2012-01-20T15:09:26","date_gmt":"2012-01-20T22:09:26","guid":{"rendered":"http:\/\/hackaday.com\/?p=65766"},"modified":"2012-01-20T16:19:11","modified_gmt":"2012-01-20T23:19:11","slug":"computing-with-the-command-line","status":"publish","type":"post","link":"https:\/\/hackaday.com\/2012\/01\/20\/computing-with-the-command-line\/","title":{"rendered":"Computing with the command line"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"65767\" data-permalink=\"https:\/\/hackaday.com\/2012\/01\/20\/computing-with-the-command-line\/gate\/\" data-orig-file=\"https:\/\/hackaday.com\/wp-content\/uploads\/2012\/01\/gate.png\" data-orig-size=\"470,317\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"gate\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/hackaday.com\/wp-content\/uploads\/2012\/01\/gate.png?w=470\" class=\"alignnone size-full wp-image-65767\" title=\"gate\" src=\"http:\/\/hackaday.com\/wp-content\/uploads\/2012\/01\/gate.png\" alt=\"\" width=\"470\" height=\"317\" srcset=\"https:\/\/hackaday.com\/wp-content\/uploads\/2012\/01\/gate.png 470w, https:\/\/hackaday.com\/wp-content\/uploads\/2012\/01\/gate.png?resize=250,169 250w, https:\/\/hackaday.com\/wp-content\/uploads\/2012\/01\/gate.png?resize=400,270 400w\" sizes=\"auto, (max-width: 470px) 100vw, 470px\" \/><\/p>\n<p>Here&#8217;s something we thought we would never see: computing with just <a href=\"http:\/\/www.linusakesson.net\/programming\/pipelogic\/index.php\" target=\"_blank\">pipes, \/dev\/zero, and \/dev\/null<\/a>.<\/p>\n<p>As a thought experiment, [Linus] imagined a null byte represented an electron.\u00a0\/dev\/zero would have an infinite supply of electrons and \/dev\/null would make a wonderful positive power supply. With a very short program (named mosfet.c), [Linus] can use Linux pipes to control the flow of electrons between \/zero and \/null.\u00a0[Linus] used mosfet.c with a very short shell script to create a NAND gate. From there all bets were off. He ended up creating a <a href=\"http:\/\/en.wikipedia.org\/wiki\/Flip-flop_(electronics)#D_flip-flop\" target=\"_blank\">D flip-flop<\/a>,\u00a0<a href=\"http:\/\/en.wikipedia.org\/wiki\/Full_adder#Full_adder\" target=\"_blank\">4-bit adder<\/a> and a counter.<\/p>\n<p>From a bit of cursory research, Linux has a maximum pipe capacity of\u00a01,048,576 bytes and the maximum number of PIDs is 4,194,304 (correct us if we&#8217;re wrong).\u00a0[Linus] \u00a0can theoretically build some of the classic CPUs of the 70s and 80s with his pipe logic. An Intel 486 <a href=\"http:\/\/en.wikipedia.org\/wiki\/Transistor_count\" target=\"_blank\">is just out of reach<\/a>, though. If you give someone a NAND or a NOR they&#8217;ll eventually build a computer; we thought we&#8217;d never see this, though.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s something we thought we would never see: computing with just pipes, \/dev\/zero, and \/dev\/null. As a thought experiment, [Linus] imagined a null byte represented an electron.\u00a0\/dev\/zero would have an <a href=\"https:\/\/hackaday.com\/2012\/01\/20\/computing-with-the-command-line\/\" class=\"read-more\">&hellip;read more<\/a><\/p>\n","protected":false},"author":21623892,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[422573559],"tags":[33927,610,14766,113812],"class_list":["post-65766","post","type-post","status-publish","format-standard","hentry","category-classic-hacks","tag-command-line","tag-linux","tag-nand","tag-pipe"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/paBn4l-h6K","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/hackaday.com\/wp-json\/wp\/v2\/posts\/65766","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hackaday.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hackaday.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hackaday.com\/wp-json\/wp\/v2\/users\/21623892"}],"replies":[{"embeddable":true,"href":"https:\/\/hackaday.com\/wp-json\/wp\/v2\/comments?post=65766"}],"version-history":[{"count":8,"href":"https:\/\/hackaday.com\/wp-json\/wp\/v2\/posts\/65766\/revisions"}],"predecessor-version":[{"id":65841,"href":"https:\/\/hackaday.com\/wp-json\/wp\/v2\/posts\/65766\/revisions\/65841"}],"wp:attachment":[{"href":"https:\/\/hackaday.com\/wp-json\/wp\/v2\/media?parent=65766"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hackaday.com\/wp-json\/wp\/v2\/categories?post=65766"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hackaday.com\/wp-json\/wp\/v2\/tags?post=65766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}