<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Shell Shortcuts</title>
	<atom:link href="http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/feed/" rel="self" type="application/rss+xml" />
	<link>http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/</link>
	<description>Enhancing your Ubuntu experience!</description>
	<lastBuildDate>Thu, 02 Feb 2012 10:29:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Erik</title>
		<link>http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3532</link>
		<dc:creator>Erik</dc:creator>
		<pubDate>Wed, 23 Jan 2008 19:12:48 +0000</pubDate>
		<guid isPermaLink="false">http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3532</guid>
		<description>Closely allied to !$ is !*, which bash expands into all of the previous command&#039;s arguments.

Suppose you use the command `ls a b c d e`, and following that, you wanted to do a `rm b`.

That&#039;s accomplished with `rm !:2`.  The !: construct lets you sniper out specific arguments from a previous command, numbered like argv[] items.

Going further with the example, can even say `rm !:2-4`, which expands to `rm b c d`.

Check out section 9.3.2 in the bash manual for more on &quot;Word Designators&quot;.</description>
		<content:encoded><![CDATA[<p>Closely allied to !$ is !*, which bash expands into all of the previous command&#8217;s arguments.</p>
<p>Suppose you use the command `ls a b c d e`, and following that, you wanted to do a `rm b`.</p>
<p>That&#8217;s accomplished with `rm !:2`.  The !: construct lets you sniper out specific arguments from a previous command, numbered like argv[] items.</p>
<p>Going further with the example, can even say `rm !:2-4`, which expands to `rm b c d`.</p>
<p>Check out section 9.3.2 in the bash manual for more on &#8220;Word Designators&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans</title>
		<link>http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3524</link>
		<dc:creator>Hans</dc:creator>
		<pubDate>Tue, 22 Jan 2008 14:43:19 +0000</pubDate>
		<guid isPermaLink="false">http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3524</guid>
		<description>^L is not a shell trick. If it works, it works because your terminal emulator wants it to. It doesn&#039;t in mine. It does however initiate a redraw in most curses-based programs (mutt, aptitude, etc.).</description>
		<content:encoded><![CDATA[<p>^L is not a shell trick. If it works, it works because your terminal emulator wants it to. It doesn&#8217;t in mine. It does however initiate a redraw in most curses-based programs (mutt, aptitude, etc.).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philipp</title>
		<link>http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3521</link>
		<dc:creator>philipp</dc:creator>
		<pubDate>Tue, 22 Jan 2008 11:28:50 +0000</pubDate>
		<guid isPermaLink="false">http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3521</guid>
		<description>I do: 
 set -o vi
and use all the wonderfull vi-commands.</description>
		<content:encoded><![CDATA[<p>I do:<br />
 set -o vi<br />
and use all the wonderfull vi-commands.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kai Grossjohann</title>
		<link>http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3520</link>
		<dc:creator>Kai Grossjohann</dc:creator>
		<pubDate>Tue, 22 Jan 2008 09:37:47 +0000</pubDate>
		<guid isPermaLink="false">http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3520</guid>
		<description>I think it is worth saying that the argument of Ctrl-R is a substring to search for.  That is, Ctrl-R x searches backwards for shell commands that have x anywhere in the line.

It is also worth noting that M-. (ESC .) can be repeated: The first time, the last word of the previous command is inserted, hitting it again replaces it with the last word of the command before that, and so on.

I like to use &quot;!!&quot; a lot, and I combine it with strings.  For example, I might type &quot;ifconfig eth0&quot; to find the current IP address, only to discover that on this box, /sbin is not in $PATH.  So I type &quot;/sbin/!!&quot; as a shortcut for &quot;/sbin/ifconfig eth0&quot;.

Another shortcut I would like to use is Ctrl-O, but I&#039;ve not yet been able to train myself.  Say you type five commands, then you want to repeat the same five commands in order.  Then you could type  to find the next command to repeat.  Or you replace  with Ctrl-O, and then you will see the correct &quot;next&quot; command in the command line.

Here&#039;s something that I use: &quot;!ma&quot; to repeat the last command that begins with &quot;ma&quot;, which most of the time will be some invocation of &quot;make&quot;.</description>
		<content:encoded><![CDATA[<p>I think it is worth saying that the argument of Ctrl-R is a substring to search for.  That is, Ctrl-R x searches backwards for shell commands that have x anywhere in the line.</p>
<p>It is also worth noting that M-. (ESC .) can be repeated: The first time, the last word of the previous command is inserted, hitting it again replaces it with the last word of the command before that, and so on.</p>
<p>I like to use &#8220;!!&#8221; a lot, and I combine it with strings.  For example, I might type &#8220;ifconfig eth0&#8243; to find the current IP address, only to discover that on this box, /sbin is not in $PATH.  So I type &#8220;/sbin/!!&#8221; as a shortcut for &#8220;/sbin/ifconfig eth0&#8243;.</p>
<p>Another shortcut I would like to use is Ctrl-O, but I&#8217;ve not yet been able to train myself.  Say you type five commands, then you want to repeat the same five commands in order.  Then you could type  to find the next command to repeat.  Or you replace  with Ctrl-O, and then you will see the correct &#8220;next&#8221; command in the command line.</p>
<p>Here&#8217;s something that I use: &#8220;!ma&#8221; to repeat the last command that begins with &#8220;ma&#8221;, which most of the time will be some invocation of &#8220;make&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomchuk</title>
		<link>http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3516</link>
		<dc:creator>tomchuk</dc:creator>
		<pubDate>Tue, 22 Jan 2008 05:19:52 +0000</pubDate>
		<guid isPermaLink="false">http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3516</guid>
		<description>Add to your ~/.inputrc :

&quot;\e[5~&quot;: history-search-backward
&quot;\e[6~&quot;: history-search-forward

Type the first few chars of a command and press page-up/page-dn</description>
		<content:encoded><![CDATA[<p>Add to your ~/.inputrc :</p>
<p>&#8220;\e[5~&#8221;: history-search-backward<br />
&#8220;\e[6~&#8221;: history-search-forward</p>
<p>Type the first few chars of a command and press page-up/page-dn</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: guignome</title>
		<link>http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3513</link>
		<dc:creator>guignome</dc:creator>
		<pubDate>Tue, 22 Jan 2008 02:16:46 +0000</pubDate>
		<guid isPermaLink="false">http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3513</guid>
		<description>I often use echo $? to get the return value of the last command. If it&#039;s different from 0, it means that something went wrong.</description>
		<content:encoded><![CDATA[<p>I often use echo $? to get the return value of the last command. If it&#8217;s different from 0, it means that something went wrong.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Schroeder</title>
		<link>http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3507</link>
		<dc:creator>Jeff Schroeder</dc:creator>
		<pubDate>Mon, 21 Jan 2008 23:16:48 +0000</pubDate>
		<guid isPermaLink="false">http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3507</guid>
		<description>This is from a tomboy note I&#039;ve got named:
bash-foo

!! - Repeats and runs previous command
echo !$ - will echo the last argument of the previous command
!ssh - Runs the most recent command that begins with ssh
!vi:p - Run the most recent vi command and only print it. This does not run the command.
!vi:s/passwd/shadow/ - Run the most recent vi command replacing passwd with shadow
!?passwd - Runs the most recent command that contains passwd anywhere

^file1^file2 - Repeat the previous command and replace the first instance of file1 with file2

CTRL E - end of line
CTRL A - beginning of line
CTRL Arrow (left or right) - left or right by 1 word
CTRL R - reverse find as you type command history search
CTRL W - delete the word to the left of the cursor (space separated)

ALT Backspace - remove 1 word in a string. ie:
	cd /etc/ssh/authorized_keys ALT Backspace would remove authorized_keys

Those are the main ones I use on a daily basis</description>
		<content:encoded><![CDATA[<p>This is from a tomboy note I&#8217;ve got named:<br />
bash-foo</p>
<p>!! &#8211; Repeats and runs previous command<br />
echo !$ &#8211; will echo the last argument of the previous command<br />
!ssh &#8211; Runs the most recent command that begins with ssh<br />
!vi:p &#8211; Run the most recent vi command and only print it. This does not run the command.<br />
!vi:s/passwd/shadow/ &#8211; Run the most recent vi command replacing passwd with shadow<br />
!?passwd &#8211; Runs the most recent command that contains passwd anywhere</p>
<p>^file1^file2 &#8211; Repeat the previous command and replace the first instance of file1 with file2</p>
<p>CTRL E &#8211; end of line<br />
CTRL A &#8211; beginning of line<br />
CTRL Arrow (left or right) &#8211; left or right by 1 word<br />
CTRL R &#8211; reverse find as you type command history search<br />
CTRL W &#8211; delete the word to the left of the cursor (space separated)</p>
<p>ALT Backspace &#8211; remove 1 word in a string. ie:<br />
	cd /etc/ssh/authorized_keys ALT Backspace would remove authorized_keys</p>
<p>Those are the main ones I use on a daily basis</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gabriel Patiño</title>
		<link>http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3506</link>
		<dc:creator>Gabriel Patiño</dc:creator>
		<pubDate>Mon, 21 Jan 2008 23:12:48 +0000</pubDate>
		<guid isPermaLink="false">http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3506</guid>
		<description>Also usefull when using a slow connection, or reseting a password input: 

ctrl-u, clears to the begining of line</description>
		<content:encoded><![CDATA[<p>Also usefull when using a slow connection, or reseting a password input: </p>
<p>ctrl-u, clears to the begining of line</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin</title>
		<link>http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3504</link>
		<dc:creator>Robin</dc:creator>
		<pubDate>Mon, 21 Jan 2008 21:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://ubuntu-tutorials.com/2008/01/21/shell-shortcuts/#comment-3504</guid>
		<description>Thanks, I didn&#039;t know esc-. or alt-., I always used !$ for that!

There&#039;s of course ctrl-a, ctrl-e, ctrl-w and alt-f (which I have mapped to ctrl-f, for easier combination with ctrl-a/w).</description>
		<content:encoded><![CDATA[<p>Thanks, I didn&#8217;t know esc-. or alt-., I always used !$ for that!</p>
<p>There&#8217;s of course ctrl-a, ctrl-e, ctrl-w and alt-f (which I have mapped to ctrl-f, for easier combination with ctrl-a/w).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: basic (User agent is rejected)
Database Caching 2/6 queries in 0.007 seconds using disk: basic
Object Caching 298/299 objects using disk: basic

Served from: ubuntu-tutorials.com @ 2012-02-09 15:37:28 -->
