{"id":2937,"date":"2018-11-08T22:36:08","date_gmt":"2018-11-08T22:36:08","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=2937"},"modified":"2018-11-12T01:01:36","modified_gmt":"2018-11-12T01:01:36","slug":"linux-fu-pimp-your-pipes","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/11\/08\/linux-fu-pimp-your-pipes\/","title":{"rendered":"Linux Fu: Pimp Your Pipes"},"content":{"rendered":"<p>One of the best things about working at the Linux (or similar OS) command line is the use of pipes. In simple terms, a pipe takes the output of one command and sends it to the input of another command. You can do a lot with a pipe, but sometimes it is hard to work out the right order for a set of pipes. A common trick is to attack it incrementally. That is, do one command and get it working with the right options and inputs. Then add another command until that works. Keep adding commands and tweaking until you get the final results.<\/p>\n<p>That\u2019s fine, but [akavel] wanted better and used Go to create <a href=\"https:\/\/github.com\/akavel\/up\" target=\"_blank\" rel=\"noopener\">\u201cup\u201d \u2014 an interactive viewer for pipelines<\/a>.<\/p>\n<h2>Pipe Philosophy<\/h2>\n<p>Pipes can do a lot. They match in with the original Unix philosophy of making each tool do one thing really well. Pipe is really good at allowing Linux commands to talk to each other. If you want to learn all about pipes, have a look at the <a href=\"http:\/\/www.linfo.org\/pipes.html\" target=\"_blank\" rel=\"noopener\">Linux Info project\u2019s guide<\/a>. They even talk about why MSDOS pipes were not really pipes at all. (One thing that write up doesn\u2019t touch on is the named pipe. Do a \u201cman fifo\u201d if you want to learn more for now and perhaps that will be the subject of a future Linux Fu.)<\/p>\n<p>This program \u2014 called <em>up<\/em> \u2014 continuously runs and reruns your pipeline as you make changes to the pipe. This way, every change you make is instantly reflected in the output. Here\u2019s the video, here\u2019s a quick video which shows off the interactive nature of <em>up<\/em>.<\/p>\n<h2>Installing<\/h2>\n<p>The GitHub page assumes you know how to install a go program. I tried doing a build but I didn\u2019t have a few dependencies. Turns out the easy way to do it was to run this line:<\/p>\n<p>go get -u github.com\/akavel\/up<\/p>\n<p>This put the executable in ~\/go\/bin \u2014 which isn\u2019t on my path. You can, of course, copy or link it to some directory that\u2019s on your path or add that directory to your path. You could also set an alias, for example. Or, like I did in the video, just specify it every time.<\/p>\n<h2>Perfect?<\/h2>\n<p>This seems like a neat simple tool. What could be better? Well, I was a little sad that you can\u2019t use emacs or vi edit keys on the pipeline, at least not as far as I could tell. This is exactly the kind of thing where you want to back up into the middle and change something. You can use the arrow keys, though, so that\u2019s something. I also wished the scrollable window had a search feature like less.<\/p>\n<p>Otherwise, though, there\u2019s not much to dislike about the little tool. If writing a pipeline is like using a C compiler, up makes it more like writing an interactive Basic program.<\/p>\n<p><a href=\"https:\/\/hackaday.com\/2018\/11\/07\/linux-fu-pimp-your-pipes\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the best things about working at the Linux (or similar OS) command line is the use of pipes. In simple terms, a pipe takes the output of one command and sends it to the input of another command. You can do a lot with a pipe, but sometimes it is hard to work &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/11\/08\/linux-fu-pimp-your-pipes\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Linux Fu: Pimp Your Pipes&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2937","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/2937","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=2937"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/2937\/revisions"}],"predecessor-version":[{"id":3153,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/2937\/revisions\/3153"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=2937"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=2937"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=2937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}