<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>commandliners</title>
	<atom:link href="http://commandliners.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://commandliners.com</link>
	<description># killall -9 X</description>
	<lastBuildDate>Wed, 27 Mar 2013 14:08:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Limit running time to a program</title>
		<link>http://commandliners.com/2013/03/limit-running-time-to-a-program/</link>
		<comments>http://commandliners.com/2013/03/limit-running-time-to-a-program/#comments</comments>
		<pubDate>Wed, 27 Mar 2013 14:08:17 +0000</pubDate>
		<dc:creator>pfortuny</dc:creator>
				<category><![CDATA[shell]]></category>
		<category><![CDATA[alarm]]></category>
		<category><![CDATA[limit]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[run]]></category>

		<guid isPermaLink="false">http://commandliners.com/?p=2573</guid>
		<description><![CDATA[There is no obvious way to specify that a program should run for no longer than x seconds. The following stackoverflow question solves it in a very perlish-way. Define a helper function doalarm: $ doalarm () { perl -e 'alarm shift; exec @ARGV' "$@"; } # define a helper function And you are done. $ [...]]]></description>
				<content:encoded><![CDATA[<p>There is no obvious way to specify that a program should run for no longer than x seconds. The following <a href="http://stackoverflow.com/questions/601543/command-line-command-to-auto-kill-a-command-after-a-certain-amount-of-time">stackoverflow</a> question solves it in a very perlish-way. Define a helper function <code>doalarm</code>:</p>
<pre><code>$ doalarm () { perl -e 'alarm shift; exec @ARGV' "$@"; } # define a helper function
</code></pre>
<p>And you are done.</p>
<pre><code>$ doalarm 300 ./my_prog
</code></pre>
<p>will run for at most 300 seconds.</p>
]]></content:encoded>
			<wfw:commentRss>http://commandliners.com/2013/03/limit-running-time-to-a-program/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spell checking</title>
		<link>http://commandliners.com/2013/03/spell-checking/</link>
		<comments>http://commandliners.com/2013/03/spell-checking/#comments</comments>
		<pubDate>Tue, 12 Mar 2013 20:29:46 +0000</pubDate>
		<dc:creator>fernape</dc:creator>
				<category><![CDATA[shell]]></category>
		<category><![CDATA[aspell]]></category>
		<category><![CDATA[ispell]]></category>
		<category><![CDATA[OpenSistemas]]></category>
		<category><![CDATA[spell checking]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://commandliners.com/?p=2553</guid>
		<description><![CDATA[aspell is a command-line spell checker. It is a replacement for the older ispell. It can be used to manage dictionaries, to check a complete file, or words typed in your terminal, among other uses. We can invoke aspell this way: $ aspell -a --lang=en @(#) International Ispell Version 3.1.20 (but really Aspell 0.60.3) This [...]]]></description>
				<content:encoded><![CDATA[<p><code>aspell</code> is a command-line spell checker. It is a replacement for the older <code>ispell</code>. It can be used to manage dictionaries, to check a complete file, or words typed in your terminal, among other uses.</p>
<p>We can invoke aspell this way:</p>
<pre><code>$ aspell -a --lang=en
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.3)</code></pre>
<p>This leaves us with a prompt in which we can type a word. For instance, if we type:</p>
<pre><code>@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.3)
hello
*

</code></pre>
<p>The asterisk indicates that aspell found the word in the dictionary. On the contrary, if we type:</p>
<pre><code>@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.3)
rescoe
&amp; rescoe 15 0: Roscoe, rescue, rescuer, Rosco, resow, resole, rescale, rescued, rescues, fresco, recce, Reece, rescan, Roscoe's, Rosco's

</code></pre>
<p>We are presented with a list of options.</p>
<p>One of the nice features of <code>aspell</code> is that it can check a complete file. This way, it interactively asks the user to take an action for every misspelled word. For example:</p>
<pre><code>$ cat test.txt
Simple text to check
the use of aspell from inside Vim
The following werd was misspelled</code></pre>
<p>If we ran:</p>
<pre><code>$ aspell --lang=en -c test.txt</code></pre>
<p>we are presented with the following screen:</p>
<pre><code>
Simple text to check
the use of aspell from inside Vim
The following werd was misspelled


1) Aspell                                                                        6) Aspell's
2) asp ell                                                                       7) Ascella
3) asp-ell                                                                       8) spill
4) Ispell                                                                        9) Ispell's
5) spell
i) Ignore                                                                        I) Ignore all
r) Replace                                                                       R) Replace all
a) Add                                                                           l) Add Lower
b) Abort                                                                         x) Exit


? 
</code></pre>
<p>This is very interesting as we can edit a file and check the spelling, but it would be nicer if we could spell check our text directly from our favorite editor&#8230;</p>
<p>You saw this coming, didn&#8217;t you? :)</p>
<h3>Spell checking from inside Vim</h3>
<p>While editing the same test.txt file with Vim, we can type the following:</p>
<pre><code>:!aspell --lang=en -c %</code></pre>
<p>This opens the <code>aspell</code> prompt which enables us to correct the misspelled words. Once we are done, Vim notifies us of the modification of the file:</p>
<pre><code>W11: Warning: File "test.txt" has changed since editing started
See ":help W11" for more info.
[O]K, (L)oad File: </code></pre>
<p>Typing L returns to Vim with the corrected file.</p>
<p>If we want to check a single word, we can type the following:</p>
<pre><code>:!echo &lt;cword&gt; \| aspell pipe --lang=en&lt;CR&gt;</code></pre>
<p>&lt;cword&gt; expands to the word under the cursor. Then we pipe this word to <code>aspell</code> for spell checking. This is somehow long to write, so it could be a good idea to define a macro:</p>
<pre><code>:map &lt;F4&gt; &lt;Esc&gt;:!echo &lt;cword&gt; \| aspell pipe --lang=en&lt;CR&gt;</code></pre>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://commandliners.com/2013/03/spell-checking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use of find with regular expressions</title>
		<link>http://commandliners.com/2013/02/use-of-find-with-regular-expressions/</link>
		<comments>http://commandliners.com/2013/02/use-of-find-with-regular-expressions/#comments</comments>
		<pubDate>Mon, 18 Feb 2013 22:00:34 +0000</pubDate>
		<dc:creator>pfortuny</dc:creator>
				<category><![CDATA[automated]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://commandliners.com/?p=2531</guid>
		<description><![CDATA[I found myself needing to write a clean: rule in a makefile which would wipe out all the auxiliary files generated by latex (among other things). Moreover, the project has some subdirectories in which there might be more of those files. Apart from finding files by date, size, modification time&#8230; the find utility can use [...]]]></description>
				<content:encoded><![CDATA[<p>I found myself needing to write a <code>clean:</code> rule in a <code>makefile</code> which would wipe out all the auxiliary files generated by latex (among other things). Moreover, the project has some subdirectories in which there might be more of those files.<br />
Apart from finding files by date, size, modification time&#8230; the <code>find</code> utility can use regular expressions. I am not delving a lot into this (what kind of expressions, etc.), I just wanted to point out two things:</p>
<ul>
<li>That it comes in quite handy.
<li>That the regex must match <i>the complete file name as reported by <code>find</code></i>.
</ul>
<p>The second item is worth noticing. If you need to find, say all the files in this directory structure having an <code>x</code>, you cannot use</p>
<pre><code>$ find . -regex 'x'
</code></pre>
<p>which, if it were a perl regex would match anything containing an <code>x</code> (assuming the quotation marks stand for the regex delimiter). What you need is to match the whole string, taking into account that any <code>find</code> in <code>.</code> starts with <code>'./'</code>. Hence, find the files in this directory structure &#8216;having an <code>x</code> in its name&#8217; is written</p>
<pre><code>$ find . -regex './.*x.*'
</code></pre>
<p>which means exactly: find all the files matching &#8216;start with dot-slash, then anything, an x and anything&#8217;, where anything can be of length 0.</p>
<p>The <code>clean:</code> in my <code>makefile</code> reads now:</p>
<pre><code>clean:
    find -E . -regex "\./.*.(aux|log|blg|bbl|~)" -exec rm -f '{}' \;
</code></pre>
<p>The <code>-E</code> option means &#8216;use modern regular expressions&#8217;, which are the ones everybody uses nowadays. I prefer using &#8216;<code>\.</code>&#8216; for &#8220;real dots,&#8221; it looks cleaner to me.</p>
<p>It has been quite a while, has it not?</p>
]]></content:encoded>
			<wfw:commentRss>http://commandliners.com/2013/02/use-of-find-with-regular-expressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When you think everything is lost&#8230;</title>
		<link>http://commandliners.com/2013/02/when-you-think-everything-is-lost/</link>
		<comments>http://commandliners.com/2013/02/when-you-think-everything-is-lost/#comments</comments>
		<pubDate>Mon, 18 Feb 2013 21:20:42 +0000</pubDate>
		<dc:creator>fernape</dc:creator>
				<category><![CDATA[shell]]></category>
		<category><![CDATA[cat]]></category>
		<category><![CDATA[OpenSistemas]]></category>
		<category><![CDATA[reset]]></category>

		<guid isPermaLink="false">http://commandliners.com/?p=2539</guid>
		<description><![CDATA[I have seen people many times doing something like this: $cat binary_file The problem with the above is that usually you end up with a prompt that looks like this: �g`�g���i`�i��k`�kX@l`(l  � Whatever you type, you get garbage in your terminal. In this case, what most people do is to despair and close the [...]]]></description>
				<content:encoded><![CDATA[<p>I have seen people many times doing something like this:<br />
<code>
<pre>$cat binary_file</pre>
<p></code><br />
The problem with the above is that <i>usually</i> you end up with a prompt that looks like this:<br />
<code>
<pre>�g`�g���i`�i��k`�kX@l`(l  �</pre>
<p></code><br />
Whatever you type, you get garbage in your terminal. In this case, what most people do is to despair and close the terminal, losing the information contained in it.
<p>
<code>reset</code> is a command that gets the terminal back to its normal state. Sometimes everything is so mangled that there is no echo from the terminal. Don&#8217;t panic, just type <code>reset</code> and press <code>ENTER</code>.
<p>
If <code>ENTER</code> does not work, try to replace it by <code>Ctrl-J</code>
<p>
If none of the above works&#8230; you can fallback to your initial idea and close the terminal.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://commandliners.com/2013/02/when-you-think-everything-is-lost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>utf-8 blues in snow leopard with mutt and vim</title>
		<link>http://commandliners.com/2012/10/utf-8-blues-in-snow-leopard-with-mutt-and-vim/</link>
		<comments>http://commandliners.com/2012/10/utf-8-blues-in-snow-leopard-with-mutt-and-vim/#comments</comments>
		<pubDate>Thu, 25 Oct 2012 19:19:06 +0000</pubDate>
		<dc:creator>pfortuny</dc:creator>
				<category><![CDATA[shell]]></category>
		<category><![CDATA[mutt]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[UTF-8]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://commandliners.com/?p=1624</guid>
		<description><![CDATA[Yes, it looks like a true spam page. But it is the only way to describe my problem. I was trying to set up mutt (yes, I am a bit fed up with Mail.app and its inability to be controlled with the keyboard alone in any sensible way). Terminal.app seems to work OK with utf-8. [...]]]></description>
				<content:encoded><![CDATA[<p>Yes, it looks like a true spam page. But it is the only way to describe my problem. I was trying to set up mutt (yes, I am a bit fed up with Mail.app and its inability to be controlled with the keyboard alone in any sensible way). Terminal.app seems to work OK with utf-8. However, the included vim does not. Any time you type an accented char and delete it, the text gets mangled (you know, typical off-by-one cursor position). The solution for vim is incredibly stupid: open up vim and write <code>:set encoding=utf-8</code> (or do that at any time while in command mode <code>ESC</code>).</p>
<p>For mutt, things are more or less according to the manual, but you must know where to look for. I ended up with the following two lines in my <code>.muttrc</code>:<br />
<code><br />
set &#038;charset ?charset<br />
set charset="utf-8"<br />
</code></p>
<p>but I am uncertain whether the first line of the two is necessary.</p>
<p>YMMV, but that works for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://commandliners.com/2012/10/utf-8-blues-in-snow-leopard-with-mutt-and-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make colored output</title>
		<link>http://commandliners.com/2012/10/make-colored-output/</link>
		<comments>http://commandliners.com/2012/10/make-colored-output/#comments</comments>
		<pubDate>Thu, 11 Oct 2012 22:18:49 +0000</pubDate>
		<dc:creator>fernape</dc:creator>
				<category><![CDATA[shell]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[make]]></category>

		<guid isPermaLink="false">http://commandliners.com/?p=2512</guid>
		<description><![CDATA[I found a nice script in stackoverflow about how to color the output of make in bash. It works by filtering the output and looking for certain expressions to highlight. Placing this function definition in your .bashrc file defines a bash make function which gets executed instead of the command. This way we can shadow [...]]]></description>
				<content:encoded><![CDATA[<p>I found a nice script in <a href="http://stackoverflow.com/questions/2437976/get-color-output-in-bash">stackoverflow</a> about how to color the output of make in bash. It works by filtering the output  and looking for certain expressions to highlight.</p>
<p>Placing this function definition in your <i>.bashrc</i> file defines a bash <b>make</b> function which gets executed instead of the command. This way we can <i>shadow</i> the real make command and create our own custom version.</p>
<pre><code>make()
{
   ccred=$(echo -e "33[1;31m")
   ccyellow=$(echo -e "33[1;33m")
   ccend=$(echo -e "33[0m")
   /usr/bin/make "$@" 2&gt;&amp;1 | sed -e "s/[Ee]rror:/$ccred&amp;$ccend/g" -e "s/[Ww]arning:/$ccyellow&amp;$ccend/g"
   return ${PIPESTATUS[0]}
}</code></pre>
<p>Of course, you can use this technique to wrap other commands as well.
<p></p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://commandliners.com/2012/10/make-colored-output/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to find alive hosts in our network</title>
		<link>http://commandliners.com/2012/08/how-to-find-alive-hosts-in-our-network/</link>
		<comments>http://commandliners.com/2012/08/how-to-find-alive-hosts-in-our-network/#comments</comments>
		<pubDate>Sun, 05 Aug 2012 10:50:49 +0000</pubDate>
		<dc:creator>rafacas</dc:creator>
				<category><![CDATA[network]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[hostname]]></category>
		<category><![CDATA[nmap]]></category>

		<guid isPermaLink="false">http://commandliners.com/?p=2108</guid>
		<description><![CDATA[Sometimes I need to know all the alive hosts&#8217; IP addresses in the LAN I am connected. The following command will show that information: $ nmap -n -sP 192.168.10.0/24 Starting Nmap 5.21 ( http://nmap.org ) at 2012-08-05 11:24 BST Nmap scan report for 192.168.10.1 Host is up (0.00086s latency). Nmap scan report for 192.168.10.40 Host [...]]]></description>
				<content:encoded><![CDATA[<p>Sometimes I need to know all the alive hosts&#8217; IP addresses in the LAN I am connected. The following command will show that information: </p>
<pre><code>$ nmap -n -sP 192.168.10.0/24

Starting Nmap 5.21 ( http://nmap.org ) at 2012-08-05 11:24 BST
Nmap scan report for 192.168.10.1
Host is up (0.00086s latency).
Nmap scan report for 192.168.10.40
Host is up (0.00057s latency).
Nmap scan report for 192.168.10.50
Host is up (0.00056s latency).
Nmap scan report for 192.168.10.100
Host is up (0.00051s latency).
Nmap done: 256 IP addresses (4 hosts up) scanned in 13.44 seconds
</code></pre>
<p>The option <code>-sP</code> tells <code>nmap</code> to do a ping scan, that is, to go no further than determining if host is online.<br />
The option <code>-n</code> will never do DNS resolution. If the hostname is needed then do not use the <code>-n</code> option or use instead the option <code>-R</code> (always resolve).</p>
]]></content:encoded>
			<wfw:commentRss>http://commandliners.com/2012/08/how-to-find-alive-hosts-in-our-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gdb &amp; nice Vim macro</title>
		<link>http://commandliners.com/2012/07/gdb-nice-vim-macro/</link>
		<comments>http://commandliners.com/2012/07/gdb-nice-vim-macro/#comments</comments>
		<pubDate>Mon, 23 Jul 2012 21:20:34 +0000</pubDate>
		<dc:creator>fernape</dc:creator>
				<category><![CDATA[shell]]></category>
		<category><![CDATA[gdb]]></category>
		<category><![CDATA[macro]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://commandliners.com/?p=2475</guid>
		<description><![CDATA[Imagine we have a simple program like the one below: #include &#60;stdio.h&#62; int main(int argc, char **argv) { char *str = "Hello guys, this is just a bit large string to test a nice Vim macro"; printf("%s\n", str); return (0); } This program is pretty simple, but it will serve its purpose. Imagine we have [...]]]></description>
				<content:encoded><![CDATA[<p>Imagine we have a simple program like the one below:</p>
<pre><code>#include &lt;stdio.h&gt;

int main(int argc, char **argv)
{

    char *str = "Hello guys, this is just a bit large string to test a nice Vim macro";

    printf("%s\n", str);

    return (0);
}</code></pre>
<p>This program is pretty simple, but it will serve its purpose. Imagine we have to inspect the content of <code>str</code> or for the same matter, any other memory address. We want to do it while we are inside a <code>gdb</code> session or while we are analyzing a <code>core</code> file. The simplest case is to do something like the following:</p>
<pre><code>(gdb) p str
$1 = 0x400642 "Hello guys, this is just a bit large string to test a nice Vim macro"</code></pre>
<p>But sometimes, we have to inspect a raw memory address, so we have to tell <code>gdb</code> to print just bytes. We can do this with the following command (the actual output may differ depending on the version of gdb you use):</p>
<pre><code>x/100c str

0x400642 &lt;.rodata&gt;:     72 'H'  101 'e' 108 'l' 108 'l' 111 'o' 32 ' '  103 'g' 117 'u'
0x40064a &lt;.rodata+8&gt;:   121 'y' 115 's' 44 ','  32 ' '  116 't' 104 'h' 105 'i' 115 's'
0x400652 &lt;.rodata+16&gt;:  32 ' '  105 'i' 115 's' 32 ' '  106 'j' 117 'u' 115 's' 116 't'
0x40065a &lt;.rodata+24&gt;:  32 ' '  97 'a'  32 ' '  98 'b'  105 'i' 116 't' 32 ' '  108 'l'
0x400662 &lt;.rodata+32&gt;:  97 'a'  114 'r' 103 'g' 101 'e' 32 ' '  115 's' 116 't' 114 'r'
0x40066a &lt;.rodata+40&gt;:  105 'i' 110 'n' 103 'g' 32 ' '  116 't' 111 'o' 32 ' '  116 't'
0x400672 &lt;.rodata+48&gt;:  101 'e' 115 's' 116 't' 32 ' '  97 'a'  32 ' '  110 'n' 105 'i'
0x40067a &lt;.rodata+56&gt;:  99 'c'  101 'e' 32 ' '  86 'V'  105 'i' 109 'm' 32 ' '  109 'm'
0x400682 &lt;.rodata+64&gt;:  97 'a'  99 'c'  114 'r' 111 'o' 0 ''  37 '%'  115 's' 10 '\n'
0x40068a &lt;.rodata+72&gt;:  0 ''  0 ''  1 '01'        27 '33'       3 '03'        59 ';'  24 '30'       0 ''
0x400692 &lt;.eh_frame_hdr+6&gt;:     0 ''  0 ''  2 '02'        0 ''  0 ''  0 ''  20 '24'       -2 'th'
0x40069a &lt;.eh_frame_hdr+14&gt;:    -1 '"y'  -1 '"y'  52 '4'  0 ''  0 ''  0 ''  36 '$'  -1 '"y'
0x4006a2 &lt;.eh_frame_hdr+22&gt;:    -1 '"y'  -1 '"y'  116 't' 0 ''</code></pre>
<p>Above we just told <code>gdb</code> to print the first hundred bytes starting at <code>str</code>. However, the output of the command is not easy to read or deal with. We can copy that text into Vim and set the following map:</p>
<pre><code>:map &lt;F7&gt; /'.'&lt;CR&gt;&lt;ESC&gt;lvy&lt;ESC&gt;maG$p`a</code></pre>
<p>Now, place the cursor at the beginning of the file (&lt;ESC&gt;gg) and press <code>F7</code> until you get the whole string written at the end.</p>
<p><strong>Explanation:</strong></p>
<p>This macro does the following:</p>
<ul>
<li>/&#8217;.'&lt;CR&gt;&lt;ESC&gt; Places the cursor at the first occurrence of &#8216;&lt;any character&gt;&#8217;. This is, the &#8220;letters&#8221; we are looking for</li>
<li>lvy Copies the character under the cursor</li>
<li>&lt;ESC&gt;ma Sets a mark at the position of the cursor so we can go back to it later.</li>
<li>G$p Goes to the end of the file (last character of the last line) and pastes the character</li>
<li>`a Goes back to the mark</li>
</ul>
<p>This way, every time we press F7, we <em>print</em> a new character at the end of the file. I have to inspect memory addresses at work very often looking for very long strings and this map saves me a lot of time.
<p></p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://commandliners.com/2012/07/gdb-nice-vim-macro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dash dash&#8230;</title>
		<link>http://commandliners.com/2012/07/dash-dash/</link>
		<comments>http://commandliners.com/2012/07/dash-dash/#comments</comments>
		<pubDate>Mon, 02 Jul 2012 22:03:46 +0000</pubDate>
		<dc:creator>fernape</dc:creator>
				<category><![CDATA[shell]]></category>
		<category><![CDATA[dash]]></category>
		<category><![CDATA[rm]]></category>

		<guid isPermaLink="false">http://commandliners.com/?p=2461</guid>
		<description><![CDATA[There are some situations when someone messes up with his text editor, file browser or shell and ends up creating a file called something like &#8220;-test&#8221;. Selecting the file on the file browser and pressing &#8220;Delete&#8221; should eliminate it. However, as you will probably have noticed, this blog is called &#8220;commandliners&#8221; so I am going [...]]]></description>
				<content:encoded><![CDATA[<p>There are some situations when someone messes up with his text editor, file browser or shell and ends up creating a file called something like &#8220;-test&#8221;.</p>
<p>Selecting the file on the file browser and pressing &#8220;Delete&#8221; should eliminate it. However, as you will probably have noticed, this blog is called &#8220;commandliners&#8221; so I am going to explain how to delete this files from a shell.</p>
<p>A naïve try would be something like the following:</p>
<pre><code>$ rm -fichero</code></pre>
<p>which leads to the following error:</p>
<pre><code>rm: illegal option -- l
usage: rm [-f | -i] [-dIPRrvW] file ...
       unlink file</code></pre>
<p>Here, <i>-file</i> is interpreted as a flag and not as a file name. You could try surrounding the name with quotes or brackets, escape the leading dash with &#8220;\&#8221;, but none of these will not work.<br />
There is however, a way to say &#8220;the following one is not a command flag although it looks like it&#8221;:</p>
<pre><code>rm -- -fichero</code></pre>
<p>The <code>--</code> (double dash) exists for this reason. You need to specify it only once, e.g:</p>
<pre><code>rm -- -file1 -file2 normal_file</code></pre>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://commandliners.com/2012/07/dash-dash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASCII codes in Vim</title>
		<link>http://commandliners.com/2012/05/ascii-codes-in-vim/</link>
		<comments>http://commandliners.com/2012/05/ascii-codes-in-vim/#comments</comments>
		<pubDate>Tue, 15 May 2012 20:14:08 +0000</pubDate>
		<dc:creator>fernape</dc:creator>
				<category><![CDATA[shell]]></category>
		<category><![CDATA[ascii]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://commandliners.com/?p=2446</guid>
		<description><![CDATA[Today, a work mate asked if anyone had an ASCII code table at hand. He was editing a file in Vim and wanted to know the ASCII code for a certain character. Here is the answer: While having the cursor on the character, type: &#60;ESC&#62;:ascii&#60;ENTER&#62; Enjoy!]]></description>
				<content:encoded><![CDATA[<p>Today, a work mate asked if anyone had an ASCII code table at hand. He was editing a file in Vim and wanted to know the ASCII code for a certain character. Here is the answer:</p>
<p>While having the cursor on the character, type:</p>
<pre><code>&lt;ESC&gt;:ascii&lt;ENTER&gt;</code></pre>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://commandliners.com/2012/05/ascii-codes-in-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.839 seconds -->
<!-- Cached page served by WP-Cache -->
