<?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>Lindesk &#187; key</title>
	<atom:link href="http://lindesk.com/tag/key/feed/" rel="self" type="application/rss+xml" />
	<link>http://lindesk.com</link>
	<description>Linux - on the Desktop</description>
	<lastBuildDate>Tue, 23 Jun 2009 14:03:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Customizing the Terminal: 6 Command Line Tips and Tricks</title>
		<link>http://lindesk.com/2009/04/customizing-the-terminal-6-command-line-tips-and-tricks/</link>
		<comments>http://lindesk.com/2009/04/customizing-the-terminal-6-command-line-tips-and-tricks/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 15:36:16 +0000</pubDate>
		<dc:creator>BinnyVA</dc:creator>
				<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[shortcut]]></category>
		<category><![CDATA[tab]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://lindesk.com/?p=188</guid>
		<description><![CDATA[A few tips and tricks on the terminal to make you more efficient when using it. If you know of any other tips, add it in the comments section.]]></description>
			<content:encoded><![CDATA[<p><img src="http://lindesk.com/wp-content/uploads/2008/02/terminal.png" alt="Terminal" title="Terminal" width="128" height="128" class="alignnone size-full wp-image-96 intro" align="right" /></p>
<p class="intro">A few tips and tricks on the terminal to make you more efficient when using it. If you know of any other tips, add it in the comments section.</p>
<h2>1. ls Without ls</h2>
<p>When you are trying to cd into a deep folder, you might not know the correct folder name some levels deep. You might have to do something like&#8230;</p>
<pre><code class="cli">$ cd ~/Scripts/Perl
$ ls
bin	SedGUI       ToSee	Cronjobs  Maintenance
$ cd Maintenance</code></pre>
<p>There is an easier way &#8211; go to the wanted folder</p>
<pre><code class="cli">$ cd ~/Scripts/Perl</code></pre>
<p>Now, without pressing enter, double tap the TAB key. You will get a list of files. And the command prompt waiting to be filled&#8230;</p>
<pre><code class="cli">$ cd ~/Scripts/Perl/[TAB TAB]
bin	SedGUI       ToSee	Cronjobs  Maintenance
$ cd ~/Scripts/Perl/_</code></pre>
<p>You can also <strong>use double-TAB to auto-complete commands</strong>.</p>
<h2>2. Searching the history with Ctrl+R</h2>
<p>If you have to use a command you have already used before, press CTRL+R and then type a few characters of the command. The latest command with those characters will be shown &#8211; if that is the command you want to execute, press enter and it will be executed. If not, just press CTRL+R again and it will show the next command.</p>
<p>You have no idea how useful this tip is if you haven&#8217;t been using it. I use this all the time.</p>
<p>For more details, read <a href="http://www.lunix.com.au/2008/07/06/searching-bash_history-the-easy-way-with-tagging-and-ctrl-r/">this article</a>.</p>
<h2>3. Open Terminal using a Shortcut</h2>
<p>If you are a GUI user, chances are you prefer using a Terminal emulator(like <code>gnome-terminal</code> or <code>konsole</code>) instead of going into the Terminal mode by pressing CTRL+ALT+F1. If so, assign a shortcut to those emulator apps. I prefer using the shortcut &#8216;Ctrl+Alt+A&#8217; to do this.</p>
<h3>Gnome</h3>
<p>If you are in gnome, there is a very easy way to do this&#8230;</p>
<ul>
<li>Go to System &gt; Preferences &gt; Keyboard Shortcuts</li>
<li>Find &#8216;Run a Terminal&#8217; &#8211; assign the shortcut &#8216;Ctrl+Alt+A&#8217;</li>
</ul>
<h3>KDE</h3>
<ul>
<li>Right Click on the K-Menu &gt; Menu Editor</li>
<li>Find your terminal application in the list(usually System &gt; Terminal Applications &gt; Terminal)</li>
<li>Select the &#8216;Current Shortcut Key&#8217; option and set it to &#8216;Ctrl+Alt+A&#8217;</li>
</ul>
<p>You can also do this by opening the <a href="http://lindesk.com/2007/09/global-hotkeys-for-xmms-using-khotkeys/">KHotKeys</a> application.</p>
<h2>4. Bash Keyboard Shortcuts</h2>
<p>Learn the <a href="http://onlyubuntu.blogspot.com/2007/03/bash-shell-keyboard-shortcuts-for-linux.html">bash keyboard shortcuts</a> &#8211; these are the ones I use the most&#8230;</p>
<dl>
<dt>CTRL+R</dt>
<dd>Search the history. We already talked about this.</dd>
<dt>CTRL+L</dt>
<dd>Clears the screen. Use this instead of the <code>clear</code> command.</dd>
<dt>CTRL+D</dt>
<dd>Use this instead of the <code>exit</code> command.</dd>
<dt>CTRL+C</dt>
<dd>Kill whatever is running</dd>
<dt>CTRL+Z</dt>
<dd>Puts whatever is running into a suspended background process. Use <code>fg</code> to restore it.</dd>
</dl>
<h2>5. Find Command using <code>apropos</code></h2>
<p>Find the command you want using the <code>apropos</code> command. Just type in a description of the command as the first argument. For example, lets say you want to find the command to list the directory contents. Use the command&#8230;</p>
<pre><code class="cli">$ apropos "directory contents"
dir                  (1)  - list directory contents
ls                   (1)  - list directory contents
ls                   (1p)  - list directory contents
ntfsls               (8)  - list directory contents on an NTFS filesystem
vdir                 (1)  - list directory contents</code></pre>
<p>The only problem is that I can never spell &#8216;apropos&#8217; &#8211; so I keep this in my <code>.bashrc</code> file&#8230;</p>
<pre><code class="bash">alias apox='apropos'</code></pre>
<h2>6. Learn New Commands</h2>
<p>There are a few sites that publish cool commands on a daily/semi-daily basics &#8211; subscribe to those and learn new commands&#8230;</p>
<li><a href="http://txt.binnyva.com/">Txt &#8211; Linux Commands and Code Snippets</a> &#8211; My own site &#8211; I <a href="http://lindesk.com/2008/07/introducing-txt/">wrote about this</a> a while ago.</li>
<li><a href="http://www.commandlinefu.com/commands/browse">commandlinefu.com</a></li>
<li><a href="http://www.shell-fu.org/">shell-fu</a></li>
<li><a href="http://snipplr.com/all/language/bash">Bash Snippets</a></li>
<li><a href="http://www.codesnippt.com/search.php?lang=14">Codesnippt.com &#8211; Shell Scripts</a></li>
<li><a href="http://snippets.dzone.com/tag/bash">bash code</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://lindesk.com/2009/04/customizing-the-terminal-6-command-line-tips-and-tricks/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
