<?xml version='1.0' encoding='utf-8' ?>

<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:atom10='http://www.w3.org/2005/Atom'>
<channel>
  <title>Command Liners</title>
  <link>https://command-liners.dreamwidth.org/</link>
  <description>Command Liners - Dreamwidth Studios</description>
  <lastBuildDate>Mon, 03 Jan 2022 10:57:27 GMT</lastBuildDate>
  <generator>LiveJournal / Dreamwidth Studios</generator>
  <lj:journal>command_liners</lj:journal>
  <lj:journaltype>community</lj:journaltype>
  <image>
    <url>https://v2.dreamwidth.org/289005/416037</url>
    <title>Command Liners</title>
    <link>https://command-liners.dreamwidth.org/</link>
    <width>100</width>
    <height>100</height>
  </image>

<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/10622.html</guid>
  <pubDate>Mon, 03 Jan 2022 10:57:27 GMT</pubDate>
  <title>Mess with DNS</title>
  <link>https://command-liners.dreamwidth.org/10622.html</link>
  <description>Posted by: &lt;span lj:user=&apos;brainwane&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://brainwane.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://brainwane.dreamwidth.org/&apos;&gt;&lt;b&gt;brainwane&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://jvns.ca/blog/2021/12/15/mess-with-dns/&quot;&gt;Julia Evans has built a site&lt;/a&gt; to help you play with DNS without messing up stuff in your life that needs to work.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=10622&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/10622.html</comments>
  <category>resources</category>
  <lj:security>public</lj:security>
  <lj:poster>brainwane</lj:poster>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/10491.html</guid>
  <pubDate>Tue, 16 Sep 2014 21:13:05 GMT</pubDate>
  <title>Getting things from the web using the command line</title>
  <link>https://command-liners.dreamwidth.org/10491.html</link>
  <description>Posted by: &lt;span lj:user=&apos;foxfirefey&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://foxfirefey.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://foxfirefey.dreamwidth.org/&apos;&gt;&lt;b&gt;foxfirefey&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I come bearing two useful utilities that each help you do things with the web from the command line:&lt;br /&gt;&lt;br /&gt;* &lt;a href=&quot;http://stedolan.github.io/jq/&quot;&gt;jq&lt;/a&gt; is a wonderful utility for working with JSON data, similar to how you can use awk for line-by-line text&lt;br /&gt;* &lt;a href=&quot;https://github.com/EricChiang/pup&quot;&gt;pup&lt;/a&gt; helps you parse HTML as a utility, inspired by jq&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=10491&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/10491.html</comments>
  <category>resources</category>
  <lj:security>public</lj:security>
  <lj:poster>foxfirefey</lj:poster>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/10024.html</guid>
  <pubDate>Sat, 28 Dec 2013 23:03:54 GMT</pubDate>
  <title>WP-CLI: Because you&apos;d prefer to manage WordPress on the command line</title>
  <link>https://command-liners.dreamwidth.org/10024.html</link>
  <description>Posted by: &lt;span lj:user=&apos;foxfirefey&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://foxfirefey.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://foxfirefey.dreamwidth.org/&apos;&gt;&lt;b&gt;foxfirefey&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;a href=&quot;http://wp-cli.org/&quot;&gt;WP-CLI&lt;/a&gt; is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;They&apos;ve even made it easy to extend!&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=10024&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/10024.html</comments>
  <lj:security>public</lj:security>
  <lj:poster>foxfirefey</lj:poster>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/9764.html</guid>
  <pubDate>Fri, 07 Jun 2013 20:08:22 GMT</pubDate>
  <title>finding a string in a directory</title>
  <link>https://command-liners.dreamwidth.org/9764.html</link>
  <description>Posted by: &lt;span lj:user=&apos;jadelennox&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://jadelennox.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://jadelennox.dreamwidth.org/&apos;&gt;&lt;b&gt;jadelennox&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Little trick I do all the time when I&apos;m looking for a string in a source tree:&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;find . -type f -exec egrep -H &quot;string I&apos;m seeking&quot; {} \;&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;The things that vary:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;find 
     base command, doesn&apos;t change
. 
     the top directory you&apos;re seeking in.  Could put a relative or absolute path here.
-type f 
     Narrowing down the kind of files you&apos;re seeking, in this case to regular files. 
     You could narrow it down in other ways, e.g. -name &quot;*.c&quot;
-exec egrep -H &quot;string I&apos;m seeking&quot; {} \;
     the grep command in question. 
     The only thing I have a very here is the egrep switch (and the string).
     -H lists filename and the match
     -l just lists the filename; less informative but cleaner.
     {} \; is necessary syntax for the exec argument to find.&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=9764&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/9764.html</comments>
  <lj:security>public</lj:security>
  <lj:poster>jadelennox</lj:poster>
  <lj:reply-count>3</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/9601.html</guid>
  <pubDate>Mon, 03 Jun 2013 05:44:31 GMT</pubDate>
  <title>curly braces on the shell</title>
  <link>https://command-liners.dreamwidth.org/9601.html</link>
  <description>Posted by: &lt;span lj:user=&apos;jadelennox&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://jadelennox.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://jadelennox.dreamwidth.org/&apos;&gt;&lt;b&gt;jadelennox&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So a fun shell trick (works in bash, tcsh, zsh) involves curly brace expansion. Different shells have different complexities, but the simplest case that works in all shells is&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;mv movies-19{92,93}.txt&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;which expands&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;mv movies-1992.txt movies-1993.txt&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;I use this daily. Usually to say &lt;tt&gt;mv foo.sh{,.bak}&lt;/tt&gt; which translates to &lt;tt&gt;mv foo.sh foo.sh.bak&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=9601&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/9601.html</comments>
  <lj:security>public</lj:security>
  <lj:poster>jadelennox</lj:poster>
  <lj:reply-count>6</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/9338.html</guid>
  <pubDate>Mon, 22 Apr 2013 05:02:39 GMT</pubDate>
  <title>seeeeeeeeeeeeed</title>
  <link>https://command-liners.dreamwidth.org/9338.html</link>
  <description>Posted by: &lt;span lj:user=&apos;shadowspar&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://shadowspar.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://shadowspar.dreamwidth.org/&apos;&gt;&lt;b&gt;shadowspar&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For some reason, I&apos;d gotten the idea into my head that &lt;tt&gt;sed(1)&lt;/tt&gt; is really arcane and difficult to use -- so much so that it wasn&apos;t really worth spending the time to learn it.  But as I&apos;ve started finding tiny uses for it, I&apos;m starting to get the impression that it&apos;s one of those tools where knowing 10% of its syntax gets you 90% of its benefit. &lt;br /&gt;&lt;br /&gt;I often have to run  &lt;tt&gt;rm -r&lt;/tt&gt; on a huge tree of thousands of small files.  It&apos;d be nice to know how far along things are, but &lt;tt&gt;rm -rv&lt;/tt&gt; shows &lt;em&gt;every&lt;/em&gt; file deletion, which is a ton of output -- enough to  overwhelm a slow terminal link.  Wouldn&apos;t it be great if you could print, say, every hundredth line or so?&lt;br /&gt;&lt;br /&gt;Enter &lt;tt&gt;sed&lt;/tt&gt;: &lt;br /&gt;&lt;br /&gt;&lt;tt&gt;rm -rv snapshot/foo | &lt;strong&gt;sed -n &apos;0~100p&apos;&lt;/strong&gt;&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;sed&lt;/tt&gt; usually prints every line as it processes it, but &lt;tt&gt;-n&lt;/tt&gt; suspends that -- lines are only printed if you explicitly ask for them with &lt;tt&gt;p&lt;/tt&gt;.  And then &lt;tt&gt;0~100&lt;/tt&gt; means &quot;operate only on every 100th line&quot;.  (&lt;tt&gt;1~100&lt;/tt&gt; would be &quot;line 1, then lines 101, 201, ...&quot;.)&lt;br /&gt;&lt;br /&gt;Another easy win with &lt;tt&gt;sed&lt;/tt&gt; is being able to feed text through a regex substitution.  F&apos;rinstance, &lt;tt&gt;lynx -dump URL&lt;/tt&gt; dumps a web page out as text, with a list of links at the bottom, like this:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
References

   1. http://example.org/lolcats-page-2/
   2. http://example.org/lolcats/lolcat-101.gif
   3. http://example.org/lolcats/lolcat-102.gif
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you wanted to download all the animated cat gifs, you&apos;d want to feed that list of links to something like &lt;tt&gt;wget&lt;/tt&gt;, without the leading numbers in the way.  But it just so happens that the leading numbers and spaces always add up to exactly six characters...so an (admittedly convoluted) way to do that is...&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;lynx -dump &lt;a href=&quot;http://example.org/lolcats/&quot;&gt;http://example.org/lolcats/&lt;/a&gt; | grep http | grep gif | sed &apos;s/^......//&apos; | wget -nc -i -&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;Anyway...in combination with all the other commands one can string together in a pipeline, I&apos;m sure &lt;tt&gt;sed&lt;/tt&gt; can be turned to a lot of other creative uses!&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=9338&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/9338.html</comments>
  <category>wget</category>
  <category>sed</category>
  <category>lynx</category>
  <lj:security>public</lj:security>
  <lj:poster>shadowspar</lj:poster>
  <lj:reply-count>2</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/9133.html</guid>
  <pubDate>Mon, 28 Jan 2013 23:00:25 GMT</pubDate>
  <title>howdoi: do your code how-to searches from the command line</title>
  <link>https://command-liners.dreamwidth.org/9133.html</link>
  <description>Posted by: &lt;span lj:user=&apos;foxfirefey&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://foxfirefey.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://foxfirefey.dreamwidth.org/&apos;&gt;&lt;b&gt;foxfirefey&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://github.com/gleitz/howdoi&quot;&gt;https://github.com/gleitz/howdoi&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=9133&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/9133.html</comments>
  <category>resources</category>
  <lj:security>public</lj:security>
  <lj:poster>foxfirefey</lj:poster>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/8784.html</guid>
  <pubDate>Thu, 17 Jan 2013 23:14:35 GMT</pubDate>
  <title>A Ping Story</title>
  <link>https://command-liners.dreamwidth.org/8784.html</link>
  <description>Posted by: &lt;span lj:user=&apos;foxfirefey&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://foxfirefey.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://foxfirefey.dreamwidth.org/&apos;&gt;&lt;b&gt;foxfirefey&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://themalkolm.dreamwidth.org/295703.html&quot;&gt;As relayed by&lt;/a&gt; &lt;span style=&apos;white-space: nowrap; text-decoration: line-through;&apos;&gt;&lt;a href=&apos;https://themalkolm.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://themalkolm.dreamwidth.org/&apos;&gt;&lt;b&gt;themalkolm&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;:&lt;br /&gt;&lt;blockquote&gt;The best ping story I&apos;ve ever heard was told to me at a USENIX conference, where a network administrator with an intermittent Ethernet had linked the ping program to his vocoder program, in essence writing:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;ping goodhost | sed -e &apos;s/.*/ping/&apos; | vocoder&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;He wired the vocoder&apos;s output into his office stereo and turned up the volume as loud as he could stand. The computer sat there shouting &quot;Ping, ping, ping...&quot; once a second, and he wandered through the building wiggling Ethernet connectors until the sound stopped. And that&apos;s how he found the intermittent failure.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=8784&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/8784.html</comments>
  <category>anecdotes</category>
  <lj:security>public</lj:security>
  <lj:poster>foxfirefey</lj:poster>
  <lj:reply-count>5</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/8672.html</guid>
  <pubDate>Fri, 02 Nov 2012 04:26:40 GMT</pubDate>
  <title>Happy Halloween!</title>
  <link>https://command-liners.dreamwidth.org/8672.html</link>
  <description>Posted by: &lt;span lj:user=&apos;foxfirefey&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://foxfirefey.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://foxfirefey.dreamwidth.org/&apos;&gt;&lt;b&gt;foxfirefey&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is a really cute bash prompt creator (ironically a GUI):&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://xta.github.com/HalloweenBash/&quot;&gt;http://xta.github.com/HalloweenBash/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=8672&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/8672.html</comments>
  <category>bash</category>
  <lj:security>public</lj:security>
  <lj:poster>foxfirefey</lj:poster>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/8404.html</guid>
  <pubDate>Fri, 09 Mar 2012 14:01:45 GMT</pubDate>
  <title>Post to Friendica with bash, curl and vim</title>
  <link>https://command-liners.dreamwidth.org/8404.html</link>
  <description>Posted by: &lt;span lj:user=&apos;tonybaldwin&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://tonybaldwin.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://tonybaldwin.dreamwidth.org/&apos;&gt;&lt;b&gt;tonybaldwin&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This script allows you to post to &lt;a href=&quot;http://www.friendica.com&quot;&gt;friendica&lt;/a&gt;, with xposting options, using bash, curl and vim.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;# update friendica with bash, vim and curl&lt;br /&gt;# I put this in my path as &quot;friendi.sh&quot;&lt;br /&gt;# by tony baldwn, &lt;a href=&quot;http://tonybaldwin.me&quot;&gt;http://tonybaldwin.me&lt;/a&gt;&lt;br /&gt;# on friendica at &lt;a href=&quot;http://free-haven.org/profile/tony&quot;&gt;http://free-haven.org/profile/tony&lt;/a&gt;&lt;br /&gt;# released according to the Gnu Public License, v.3&lt;br /&gt;&lt;br /&gt;# first, create a post/update&lt;br /&gt;&lt;br /&gt;filedate=$(date +%m%d%y%H%M%S)&lt;br /&gt;&lt;br /&gt;# if you did not enter text for update, the script asks for it&lt;br /&gt;&lt;br /&gt;if [[ $(echo $*) ]]; then&lt;br /&gt;	ud=&quot;$*&quot;&lt;br /&gt;else&lt;br /&gt;	vim $filedate.fpost&lt;br /&gt;	ud=$(cat $filedate.fpost)&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;# now to see if you want to crosspost elsewhere&lt;br /&gt;echo &quot;For the following question regarding crossposting, please enter the number 1 for yes, and 0 for no.&quot;&lt;br /&gt;echo &quot;If your friendica has the plugins, and you&apos;ve configured them, you can crosspost to other blogs and sites.&quot;&lt;br /&gt;echo &quot;friendica will even automatically change the bbcode to proper html for you.&quot;&lt;br /&gt;echo &quot;would you like to crosspost to &quot;&lt;br /&gt;read -p &quot;statusnet? &quot; snet&lt;br /&gt;read -p &quot;twitter? &quot; twit&lt;br /&gt;read -p &quot;facebook? &quot; fb&lt;br /&gt;read -p &quot;dreamwidth?  &quot; dw&lt;br /&gt;read -p &quot;livejournal? &quot; lj&lt;br /&gt;read -p &quot;tumblr? &quot; tum&lt;br /&gt;read -p &quot;posterous? &quot; pos&lt;br /&gt;read -p &quot;wordpress? &quot; wp &lt;br /&gt;&lt;br /&gt;# now to authenticate&lt;br /&gt;read -p &quot;Please enter your username: &quot; uname&lt;br /&gt;read -p &quot;Please enter your password: &quot; pwrd&lt;br /&gt;read -p &quot;Enter the domain of your Friendica site (i.e. &lt;a href=&quot;http://friendica.somesite.net&quot;&gt;http://friendica.somesite.net&lt;/a&gt;, without trailing /): &quot; url&lt;br /&gt;&lt;br /&gt;# and this is the curl command that sends the update to the server&lt;br /&gt;&lt;br /&gt;if [[ $(curl -u $uname:$pwrd  -d &quot;status=$ud&amp;ljpost_enable=$lj&amp;posterous_enable=$pos&amp;dwpost_enable=$dw&amp;wppost_enable=$wp&amp;tumblr_enable=$tum&amp;facebook_enable=$fb&amp;twitter_enable=$twit&amp;statusnet_enable=$snet&amp;source=friendi.sh&quot;  $url/api/statuses/update.xml | grep error) ]]; then&lt;br /&gt;&lt;br /&gt;# what does the server say?&lt;br /&gt;&lt;br /&gt;	echo &quot;Error&quot;&lt;br /&gt;else &lt;br /&gt;	echo &quot;Success!&quot;&lt;br /&gt;	echo $ud&lt;br /&gt;fi&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;find me on friendica at &lt;a href=&quot;https://free-haven.org/profile/tony&quot;&gt;tony@free-haven.org&lt;/a&gt;.&lt;br /&gt;see more of my scripts, in bash, tcl, python, and more, at &lt;a href=&quot;http://tonybaldwin.me/hax&quot;&gt;http://tonybaldwin.me/hax&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=8404&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/8404.html</comments>
  <category>bash</category>
  <category>curl</category>
  <category>friendica</category>
  <category>vim</category>
  <lj:security>public</lj:security>
  <lj:poster>tonybaldwin</lj:poster>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/8096.html</guid>
  <pubDate>Thu, 29 Dec 2011 20:46:23 GMT</pubDate>
  <title>Generating a comma-separated list from grep</title>
  <link>https://command-liners.dreamwidth.org/8096.html</link>
  <description>Posted by: &lt;span lj:user=&apos;sophie&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://sophie.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://sophie.dreamwidth.org/&apos;&gt;&lt;b&gt;sophie&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Sometimes you want to paste the output of a &lt;code&gt;grep&lt;/code&gt; command into IRC or IM, and don&apos;t want each match on a separate line. Fortunately, it&apos;s easy to convert it to a comma-separated list instead - simply pipe the output through &lt;code&gt;xargs echo | sed &apos;s/ /, /g&apos;&lt;/code&gt;. So, for example, instead of:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;Sophie@Sophie-Laptop:~/primtionary$ grep cuddle american-english-insane&lt;br /&gt;cuddle&lt;br /&gt;cuddleable&lt;br /&gt;cuddled&lt;br /&gt;cuddler&lt;br /&gt;cuddlers&lt;br /&gt;cuddles&lt;br /&gt;cuddlesome&lt;br /&gt;scuddle&lt;br /&gt;scuddled&lt;br /&gt;scuddles&lt;br /&gt;upscuddle&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;...you get:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;Sophie@Sophie-Laptop:~/primtionary$ grep cuddle american-english-insane | xargs echo | sed &apos;s/ /, /g&apos;&lt;br /&gt;cuddle, cuddleable, cuddled, cuddler, cuddlers, cuddles, cuddlesome, scuddle, scuddled, scuddles, upscuddle&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Very useful sometimes :D&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=8096&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/8096.html</comments>
  <lj:security>public</lj:security>
  <lj:poster>sophie</lj:poster>
  <lj:reply-count>6</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/7871.html</guid>
  <pubDate>Wed, 30 Nov 2011 19:45:33 GMT</pubDate>
  <title>sort and uniq</title>
  <link>https://command-liners.dreamwidth.org/7871.html</link>
  <description>Posted by: &lt;span lj:user=&apos;sophie&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://sophie.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://sophie.dreamwidth.org/&apos;&gt;&lt;b&gt;sophie&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Just a quickie - today I learned that instead of piping something through &lt;code&gt;sort&lt;/code&gt; and then piping the output of that through &lt;code&gt;uniq&lt;/code&gt;, you can just use &lt;code&gt;sort -u&lt;/code&gt;, which will do both operations at once.&lt;br /&gt;&lt;br /&gt;Unfortunately this doesn&apos;t help when you&apos;re doing something like &lt;code&gt;sort | uniq -c | sort -n&lt;/code&gt; to sort by the number of times a line appears, but it&apos;s still a nice tip. :)&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=7871&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/7871.html</comments>
  <lj:security>public</lj:security>
  <lj:poster>sophie</lj:poster>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/7668.html</guid>
  <pubDate>Wed, 23 Nov 2011 20:42:27 GMT</pubDate>
  <title>Bad command line habits and good ones to replace them</title>
  <link>https://command-liners.dreamwidth.org/7668.html</link>
  <description>Posted by: &lt;span lj:user=&apos;foxfirefey&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://foxfirefey.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://foxfirefey.dreamwidth.org/&apos;&gt;&lt;b&gt;foxfirefey&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/aix/library/au-badunixhabits.html&quot;&gt;UNIX tips: Learn 10 good UNIX usage habits&lt;/a&gt;, as follows:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;Make directory trees in a single swipe.&lt;/li&gt;
&lt;li&gt;Change the path; do not move the archive.&lt;/li&gt;
&lt;li&gt;Combine your commands with control operators.&lt;/li&gt;
&lt;li&gt;Quote variables with caution.&lt;/li&gt;
&lt;li&gt;Use escape sequences to manage long input.&lt;/li&gt;
&lt;li&gt;Group your commands together in a list.&lt;/li&gt;
&lt;li&gt;Use xargs outside of find .&lt;/li&gt;
&lt;li&gt;Know when grep should do the counting -- and when it should step aside.&lt;/li&gt;
&lt;li&gt;Match certain fields in output, not just lines.&lt;/li&gt;
&lt;li&gt;Stop piping cats.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;I learned a couple of things from this one!&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=7668&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/7668.html</comments>
  <lj:security>public</lj:security>
  <lj:poster>foxfirefey</lj:poster>
  <lj:reply-count>7</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/7356.html</guid>
  <pubDate>Fri, 11 Nov 2011 21:36:03 GMT</pubDate>
  <title>vim diagraphs</title>
  <link>https://command-liners.dreamwidth.org/7356.html</link>
  <description>Posted by: &lt;span lj:user=&apos;foxfirefey&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://foxfirefey.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://foxfirefey.dreamwidth.org/&apos;&gt;&lt;b&gt;foxfirefey&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&apos;white-space: nowrap;&apos;&gt;&lt;a href=&apos;https://shadowspar.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://shadowspar.dreamwidth.org/&apos;&gt;&lt;b&gt;shadowspar&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&apos;s just made a great post about &lt;a href=&quot;http://shadowspar.dreamwidth.org/64730.html&quot;&gt;using diagraphs in vim...and making &amp;lt;3 into one of them!&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=7356&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/7356.html</comments>
  <category>vi</category>
  <lj:security>public</lj:security>
  <lj:poster>foxfirefey</lj:poster>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/6971.html</guid>
  <pubDate>Mon, 25 Jul 2011 15:16:29 GMT</pubDate>
  <title>Expanding shortened URLs with wget</title>
  <link>https://command-liners.dreamwidth.org/6971.html</link>
  <description>Posted by: &lt;span lj:user=&apos;tara_hanoi&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://tara-hanoi.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://tara-hanoi.dreamwidth.org/&apos;&gt;&lt;b&gt;tara_hanoi&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Cross-posted from my &lt;a href=&quot;http://tara-hanoi.dreamwidth.org/1624.html&quot;&gt;main blog&lt;/a&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;I&apos;m a fan of twitter, and one of the features of the territory is shortened links. The twitter web interface generally does a half-decent job of expanding these posts, but I don&apos;t always get to see the expanded link.&lt;br /&gt;&lt;br /&gt;Sometimes I want to see where the link leads without actually visiting the site in case it&apos;s hosting malicious scripts. After a little bit of digging I found that wget can do exactly what I want. I have a little throwaway directory (in my case, &apos;/export/home/sketchy&apos;, which allows me to see where the link points to.&lt;br /&gt;&lt;br /&gt;For example, let&apos;s say I see a link (it leads to a blog post of mine, so nothing very interesting) and want to know where it leads:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;tara_hanoi@tara_babel:/export/home/sketchy$ wget --max-redirect=0 &lt;a href=&quot;http://t.co/8xED8dz&quot;&gt;http://t.co/8xED8dz&lt;/a&gt;&lt;br /&gt;--2011-07-25 16:01:10--  &lt;a href=&quot;http://t.co/8xED8dz&quot;&gt;http://t.co/8xED8dz&lt;/a&gt;&lt;br /&gt;Resolving t.co... 199.59.148.12&lt;br /&gt;Connecting to t.co|199.59.148.12|:80... connected.&lt;br /&gt;&lt;b&gt;HTTP request sent, awaiting response... 301 Moved Permanently&lt;br /&gt;Location: &lt;a href=&quot;http://bit.ly/guxtdh&quot;&gt;http://bit.ly/guxtdh&lt;/a&gt; [following]&lt;/b&gt;&lt;br /&gt;0 redirections exceeded.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The bit in bold is where you should be paying attention. In this case, the t.co link points to another shortener, bit.ly - if I want to follow that on, I don&apos;t have to paste that back into wget, I can just increase the &apos;max-redirect&apos; parameter:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;tara_hanoi@tara_babel:/export/home/sketchy$ wget --max-redirect=&lt;b&gt;1&lt;/b&gt; &lt;a href=&quot;http://t.co/8xED8dz&quot;&gt;http://t.co/8xED8dz&lt;/a&gt;&lt;br /&gt;--2011-07-25 16:03:50--  &lt;a href=&quot;http://t.co/8xED8dz&quot;&gt;http://t.co/8xED8dz&lt;/a&gt;&lt;br /&gt;Resolving t.co... 199.59.148.12&lt;br /&gt;Connecting to t.co|199.59.148.12|:80... connected.&lt;br /&gt;HTTP request sent, awaiting response... 301 Moved Permanently&lt;br /&gt;Location: &lt;a href=&quot;http://bit.ly/guxtdh&quot;&gt;http://bit.ly/guxtdh&lt;/a&gt; [following]&lt;br /&gt;--2011-07-25 16:03:51--  &lt;a href=&quot;http://bit.ly/guxtdh&quot;&gt;http://bit.ly/guxtdh&lt;/a&gt;&lt;br /&gt;Resolving bit.ly... 168.143.172.53, 2001:418:e801::12:1, 2001:418:e801::15:1, ...&lt;br /&gt;Connecting to bit.ly|168.143.172.53|:80... connected.&lt;br /&gt;&lt;b&gt;HTTP request sent, awaiting response... 301 Moved&lt;br /&gt;Location: &lt;a href=&quot;http://tara-hanoi.dreamwidth.org/1508.html&quot;&gt;http://tara-hanoi.dreamwidth.org/1508.html&lt;/a&gt; [following]&lt;/b&gt;&lt;br /&gt;1 redirections exceeded.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Ok, so it leads to my own DW entry, so I&apos;m pretty sure it&apos;s ok.&lt;br /&gt;&lt;br /&gt;This might be useful for folks as a quick and dirty way to expand shortened URLs.&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=6971&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/6971.html</comments>
  <lj:security>public</lj:security>
  <lj:poster>tara_hanoi</lj:poster>
  <lj:reply-count>3</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/6770.html</guid>
  <pubDate>Thu, 28 Apr 2011 19:04:03 GMT</pubDate>
  <title>Removing Windows carriage-returns from text files</title>
  <link>https://command-liners.dreamwidth.org/6770.html</link>
  <description>Posted by: &lt;span lj:user=&apos;chebe&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://chebe.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://chebe.dreamwidth.org/&apos;&gt;&lt;b&gt;chebe&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hey all, don&apos;t think I&apos;ve seen this here before, and I know there are &lt;i&gt;many&lt;/i&gt; ways of doing this, so I thought, in a fit of geekery, that it might be fun to try and collect them all! Afterall everyone does have their own favourite programs.&lt;br /&gt;&lt;br /&gt;I posted this at my own journal &lt;a target=&quot;_blank&quot; href=&quot;http://chebe.dreamwidth.org/32400.html&quot;&gt;when I first came across it&lt;/a&gt;, but here&apos;s a new one as well;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;sed -i &apos;s/\r//&apos; $file_name&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;perl -pi -e &apos;s/\r\n/\n/g&apos; $file_name&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=6770&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/6770.html</comments>
  <category>sh</category>
  <lj:mood>silly</lj:mood>
  <lj:security>public</lj:security>
  <lj:poster>chebe</lj:poster>
  <lj:reply-count>8</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/6634.html</guid>
  <pubDate>Mon, 20 Dec 2010 15:09:05 GMT</pubDate>
  <title>UbuntuOne &amp; dotfiles (Or, home is where the dotfiles are...)</title>
  <link>https://command-liners.dreamwidth.org/6634.html</link>
  <description>Posted by: &lt;span lj:user=&apos;pixel&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://pixel.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://pixel.dreamwidth.org/&apos;&gt;&lt;b&gt;pixel&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Using UbuntuOne to sync dotfiles across several, possibly remote machines.  I don&apos;t know if this would work with say, Dropbox, because I&apos;ve never used it but I guess it could be adapted to any of those cloud services if you can access them from the command line, and most importantly make a symbolic link to that directory.&lt;br /&gt;&lt;br /&gt;The genesis for this is the fact that I like to use a)taskwarrior and b)my netbook.  So I happen to have multiple computers that run Ubuntu and maybe I&apos;m in the minority in that.  I wanted my tasks to be available wherever I was.  I still haven&apos;t figured out how to pull them onto my Android phone but I&apos;ll keep working on that.&lt;br /&gt;&lt;br /&gt;Taskwarrior uses some text files stored in ~/.task/ by default.  I initially attempted to just sync the directory but that won&apos;t work.  At some point I asked in launchpad I think and never got an answer.&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;cut-wrapper&quot;&gt;&lt;span style=&quot;display: none;&quot; id=&quot;span-cuttag___1&quot; class=&quot;cuttag&quot;&gt;&lt;/span&gt;&lt;b class=&quot;cut-open&quot;&gt;(&amp;nbsp;&lt;/b&gt;&lt;b class=&quot;cut-text&quot;&gt;&lt;a href=&quot;https://command-liners.dreamwidth.org/6634.html#cutid1&quot;&gt;In the end I got it working like so...&lt;/a&gt;&lt;/b&gt;&lt;b class=&quot;cut-close&quot;&gt;&amp;nbsp;)&lt;/b&gt;&lt;/span&gt;&lt;div style=&quot;display: none;&quot; id=&quot;div-cuttag___1&quot; aria-live=&quot;assertive&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=6634&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/6634.html</comments>
  <lj:mood>blank</lj:mood>
  <lj:security>public</lj:security>
  <lj:poster>pixel</lj:poster>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/6210.html</guid>
  <pubDate>Mon, 29 Nov 2010 18:53:39 GMT</pubDate>
  <title>Text editor recs?</title>
  <link>https://command-liners.dreamwidth.org/6210.html</link>
  <description>Posted by: &lt;span lj:user=&apos;brownbetty&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://brownbetty.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://brownbetty.dreamwidth.org/&apos;&gt;&lt;b&gt;brownbetty&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I want a command line text editor that can do a soft-word wrap.  By &quot;soft,&quot; I mean that long lines won&apos;t scroll past the right edge of my screen, but when I save my file, I won&apos;t discover it&apos;s had a mess of line breaks inserted into my text every seventy-odd chars.&lt;br /&gt;&lt;br /&gt;I&apos;d be mostly writing in natural English, so emacs or vi are rather more complicated than I&apos;m looking for, but if you tell me one of them is my only solution, I will cry and then suck it up and learn to use whichever.&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=6210&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/6210.html</comments>
  <lj:security>public</lj:security>
  <lj:poster>brownbetty</lj:poster>
  <lj:reply-count>6</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/6006.html</guid>
  <pubDate>Sat, 06 Nov 2010 02:23:32 GMT</pubDate>
  <title>An alternative to the pipe (in bash/ksh)</title>
  <link>https://command-liners.dreamwidth.org/6006.html</link>
  <description>Posted by: &lt;span lj:user=&apos;sophie&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://sophie.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://sophie.dreamwidth.org/&apos;&gt;&lt;b&gt;sophie&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Most people in here will probably know how to pipe output from one command to another:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;command 1 | command2&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;However, what if &lt;code&gt;command2&lt;/code&gt; doesn&apos;t allow reading from standard input, and only supports filenames? How can you do this without writing to a file?&lt;br /&gt;&lt;br /&gt;It turns out that you can do this in bash and ksh by using the &lt;code&gt;&amp;lt;(command)&lt;/code&gt; syntax. For example, the above command can be written:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;command2 &amp;lt;(command1)&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This will execute &lt;code&gt;command1&lt;/code&gt; in a subshell, and at the same time, call &lt;code&gt;command2&lt;/code&gt; with a &lt;b&gt;file descriptor&lt;/b&gt; looking something like &lt;code&gt;/dev/fd/63&lt;/code&gt;. When &lt;code&gt;command2&lt;/code&gt; reads from that, it&apos;ll get the output of &lt;code&gt;command1&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;At first this doesn&apos;t seem too useful, but this means that you can do nifty things like this:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;diff -u &amp;lt;(sort filea.txt) &amp;lt;(sort fileb.txt)&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Which will sort filea.txt and fileb.txt, and then diff the outputs - all without writing a single file.&lt;br /&gt;&lt;br /&gt;Note that if the subshells require user input, this isn&apos;t going to work, so you can&apos;t use this to capture user input and pass it to a script which would otherwise require a filename. However, as long as this isn&apos;t the case, everything should work smoothly.&lt;br /&gt;&lt;br /&gt;[edit: Oh, and I should mention that, &lt;s&gt;unlike piping,&lt;/s&gt; you can execute several commands in the subshell. For example:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;rev &amp;lt;(echo wheeness; sleep 2; echo blarg)&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This also demonstrates how both the subshell and the main process run simultaneously; the output is &quot;sseneehw&quot;, followed by a delay of 2 seconds, followed by &quot;gralb&quot;.]&lt;br /&gt;&lt;br /&gt;[edit 2: See &lt;a href=&quot;http://command-liners.dreamwidth.org/6006.html?thread=28278#cmt28278&quot;&gt;this comment&lt;/a&gt; for an example of how to run multiple commands via piping!]&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=6006&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/6006.html</comments>
  <category>bash</category>
  <category>ksh</category>
  <lj:security>public</lj:security>
  <lj:poster>sophie</lj:poster>
  <lj:reply-count>6</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/5884.html</guid>
  <pubDate>Wed, 03 Nov 2010 13:43:25 GMT</pubDate>
  <title>xargs and apostrophes/spaces</title>
  <link>https://command-liners.dreamwidth.org/5884.html</link>
  <description>Posted by: &lt;span lj:user=&apos;sophie&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://sophie.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://sophie.dreamwidth.org/&apos;&gt;&lt;b&gt;sophie&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you&apos;ve ever tried using xargs with a list of filenames, you&apos;ve probably at some point come across errors like these:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;ls: cannot access /home/sophie/directory: No such file or directory&lt;br /&gt;ls: cannot access with: No such file or directory&lt;br /&gt;ls: cannot access spaces: No such file or directory&lt;br /&gt;ls: cannot access in/blah.txt: No such file or directory&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Both of these errors are due to xargs by default interpreting some characters as special; in the first one, it won&apos;t allow apostrophes, and in the second it treats spaces as if they meant separate arguments. And the -0 switch doesn&apos;t help at all if you&apos;re using newlines.&lt;br /&gt;&lt;br /&gt;Both of these errors can be resolved very easily: just add the &lt;code&gt;-d&quot;\n&quot;&lt;/code&gt; switch before the command you want xargs to execute. This tells xargs that you don&apos;t want xargs to mess with your input at all except to treat newline characters as delimiters. This time, you should find that both apostrophes and spaces are accepted properly.&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=5884&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/5884.html</comments>
  <category>xargs</category>
  <lj:security>public</lj:security>
  <lj:poster>sophie</lj:poster>
  <lj:reply-count>13</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/5565.html</guid>
  <pubDate>Tue, 02 Nov 2010 20:00:41 GMT</pubDate>
  <title>Parameter expansion to loop over pairs: ${a%b} and ${a#b}</title>
  <link>https://command-liners.dreamwidth.org/5565.html</link>
  <description>Posted by: &lt;span lj:user=&apos;karmag&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://karmag.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://karmag.dreamwidth.org/&apos;&gt;&lt;b&gt;karmag&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Hey, a command line community?  That&apos;s a pretty neat thing to have.&lt;/p&gt;
&lt;p&gt;So to introduce myself, here&apos;s something I figured out pretty recently.  It&apos;s in one of those eyes-glazing-over parts of the shell man page (but I had a specific problem to solve so I had to figure it out).  Behold!  It is a piece of &quot;parameter expansion&quot; magic:&lt;/p&gt;
&lt;code&gt;$ TEST=&apos;foo:bar&apos; ; echo ${TEST%:*} ${TEST#*:}&lt;br /&gt;
foo bar&lt;/code&gt;
&lt;p&gt;Ooh, exciting!  No wait, it&apos;s not.  But here&apos;s the problem I had: How can I loop over &lt;em&gt;pairs&lt;/em&gt; of values in a script or one-liner?&lt;/p&gt;
&lt;p&gt;The solution I came up with looked something like this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;$ for f in url1:filename1 url2:filename2 url3:filename3; &lt;br /&gt;do URL=${f%:*}; FILENAME=${f#*:} ; &lt;br /&gt;... &lt;br /&gt;; done&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;...and so for each pair, URL and FILENAME gets set to their respective portion.  (And you&apos;ll be glad to learn that I got my Youtube-mediated crime drama fix in the end.)&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=5565&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/5565.html</comments>
  <category>sh</category>
  <lj:security>public</lj:security>
  <lj:poster>karmag</lj:poster>
  <lj:reply-count>7</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/5200.html</guid>
  <pubDate>Mon, 01 Nov 2010 13:48:35 GMT</pubDate>
  <title>Bash vi mode</title>
  <link>https://command-liners.dreamwidth.org/5200.html</link>
  <description>Posted by: &lt;span lj:user=&apos;razputnik&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://razputnik.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://razputnik.dreamwidth.org/&apos;&gt;&lt;b&gt;razputnik&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I noticed a few people making posts about editing their shell history with vi - so I thought I&apos;d contribute this little trick that someone may or may not have mentioned already:&lt;br /&gt;&lt;br /&gt;If you add &quot;set -o vi&quot; to the end of your .bashrc, it changes your command line editing mode to vi keybindings, meaning you can use hjkl to navigate through your history and edit lines using vi oldies but goldies like cw and c$. It&apos;s a bit of a pain to get used to at first, but it&apos;s good if you&apos;re the type who keeps typing cw when you want to change an argument and then get annoyed when it just inserts that as text.&lt;br /&gt;&lt;br /&gt;:wq&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=5200&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/5200.html</comments>
  <category>bash</category>
  <category>vi</category>
  <lj:security>public</lj:security>
  <lj:poster>razputnik</lj:poster>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/4982.html</guid>
  <pubDate>Wed, 01 Sep 2010 14:38:36 GMT</pubDate>
  <title>Nifty perl trick I learned about todayyesterday</title>
  <link>https://command-liners.dreamwidth.org/4982.html</link>
  <description>Posted by: &lt;span lj:user=&apos;pauamma&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://pauamma.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://pauamma.dreamwidth.org/&apos;&gt;&lt;b&gt;pauamma&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Context was someone asking why&lt;blockquote&gt;print &quot;Hello, world!\n&quot; &amp;amp;&amp;amp; die;&lt;/blockquote&gt;doesn&apos;t output anything. Someone replied with a nifty trick to help figure this out:&lt;blockquote&gt;perl -MO=Deparse -e &apos;print &quot;Hello, world!\n&quot; &amp;amp;&amp;amp; die;&apos;&lt;/blockquote&gt;or&lt;blockquote&gt;perl -MO=Deparse,-p -e &apos;print &quot;Hello, world!\n&quot; &amp;amp;&amp;amp; die;&apos;&lt;/blockquote&gt;(go ahead and try it).&lt;br /&gt;&lt;br /&gt;Note: -p won&apos;t make a difference here, but it helps if you suspect perl&apos;s notion of operator priorities is different from yours.&lt;br /&gt;&lt;br /&gt;(crossposted from &lt;a href=&quot;http://dw-dev-training.dreamwidth.org/23661.html&quot;&gt;http://dw-dev-training.dreamwidth.org/23661.html&lt;/a&gt; at pne&apos;s suggestion)&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=4982&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/4982.html</comments>
  <category>perl</category>
  <lj:security>public</lj:security>
  <lj:poster>pauamma</lj:poster>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/4677.html</guid>
  <pubDate>Wed, 04 Aug 2010 16:13:28 GMT</pubDate>
  <title>tcsh to bash</title>
  <link>https://command-liners.dreamwidth.org/4677.html</link>
  <description>Posted by: &lt;span lj:user=&apos;jadelennox&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://jadelennox.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://jadelennox.dreamwidth.org/&apos;&gt;&lt;b&gt;jadelennox&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I&apos;ve been a tcsh user now for... well, for a very long time, and a csh user before that. Understandably, that means that I&apos;m at least a low-level tcsh power user. However, because I do anything that requires a complex control flow in bash, I&apos;ve been thinking about switching to bash for my everyday commandline needs.&lt;br /&gt;&lt;br /&gt;But it&apos;s scary, because I don&apos;t want to switch out of a shell where I am a power user. Does anybody have any links to good resources for switching from tcsh to bash? Handholding, tips, or the like?&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=4677&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/4677.html</comments>
  <lj:security>public</lj:security>
  <lj:poster>jadelennox</lj:poster>
  <lj:reply-count>3</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://command-liners.dreamwidth.org/4470.html</guid>
  <pubDate>Tue, 03 Aug 2010 21:41:27 GMT</pubDate>
  <title>bash history search</title>
  <link>https://command-liners.dreamwidth.org/4470.html</link>
  <description>Posted by: &lt;span lj:user=&apos;sophie&apos; style=&apos;white-space: nowrap;&apos; class=&apos;ljuser&apos;&gt;&lt;a href=&apos;https://sophie.dreamwidth.org/profile&apos;&gt;&lt;img src=&apos;https://www.dreamwidth.org/img/silk/identity/user.png&apos; alt=&apos;[personal profile] &apos; width=&apos;17&apos; height=&apos;17&apos; style=&apos;vertical-align: text-bottom; border: 0; padding-right: 1px;&apos; /&gt;&lt;/a&gt;&lt;a href=&apos;https://sophie.dreamwidth.org/&apos;&gt;&lt;b&gt;sophie&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A quick tip for bash users that I use all the time:&lt;br /&gt;&lt;br /&gt;If you have a command in your history that you want to re-execute or edit, but don&apos;t want to keep tapping the up key, hit Ctrl-R and then start typing part of the line. bash will find the last line matching your input on the fly. If it&apos;s not the one you want, either keep typing until it is, or hit Ctrl-R and bash will show you the next match.&lt;br /&gt;&lt;br /&gt;Once you&apos;ve got it, you have two options: to execute, you can then just press RETURN; to edit, use a movement key (left/right arrows, Home/End, etc) and bash will drop you back to a standard command line with the line you just found.&lt;br /&gt;&lt;br /&gt;This trick also works if you know the middle of the line but not the beginning, since bash searches the entire line.&lt;br /&gt;&lt;br /&gt;[edited to add: BTW, Fey, do you realise that nobody can add new tags to posts in this community? The only tags in here are ones first used by you. :)]&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=command_liners&amp;ditemid=4470&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://command-liners.dreamwidth.org/4470.html</comments>
  <category>bash</category>
  <lj:security>public</lj:security>
  <lj:poster>sophie</lj:poster>
  <lj:reply-count>6</lj:reply-count>
</item>
</channel>
</rss>
