<?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; alias</title>
	<atom:link href="http://lindesk.com/tag/alias/feed/" rel="self" type="application/rss+xml" />
	<link>http://lindesk.com</link>
	<description>Linux - on the Desktop</description>
	<lastBuildDate>Tue, 19 Jan 2010 05:54:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Customizing the Terminal: Create Useful Aliases</title>
		<link>http://lindesk.com/2009/03/customizing-the-terminal-create-useful-aliases/</link>
		<comments>http://lindesk.com/2009/03/customizing-the-terminal-create-useful-aliases/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 19:05:56 +0000</pubDate>
		<dc:creator>BinnyVA</dc:creator>
				<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[alias]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[customize]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://lindesk.com/?p=183</guid>
		<description><![CDATA[This is part two of the 'Customizing the Terminal' series. Part one is '<a href="http://lindesk.com/2009/03/customizing-the-terminal-the-prompt/">Customizing the Terminal: The Prompt</a>'. In this part, we'll see how to create aliases to make working in the console easier.]]></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">This is part two of the &#8216;Customizing the Terminal&#8217; series. Part one is &#8216;<a href="http://lindesk.com/2009/03/customizing-the-terminal-the-prompt/">Customizing the Terminal: The Prompt</a>&#8216;. In this part, we&#8217;ll see how to create aliases to make working in the console easier.</p>
<h2>How To Create an Alias</h2>
<p>You can create a temporary alias using this command&#8230;</p>
<pre><code class="bash">alias new_name='old command'</code></pre>
<p>This will stop working when you exit the terminal. If you want to make the alias permanent, put the same command in your <code>~/.bashrc</code> file.</p>
<p>There is another way to create an alias &#8211; create a executable file and place it in a folder in your path. This is not technically an alias &#8211; but it works the same way. I use this for alias that tend to change often. Its easier to find a file in a folder and edit it. <abbr title="YMMV">YMMV</abbr>.</p>
<h2>My Aliases</h2>
<p>This is a incomplete list of the aliases I use. Feel free to copy them to your .bashrc file.</p>
<h3>Quick Directory Jumps</h3>
<p>Create an alias to jump to folders you have to visit often. This is my list&#8230;</p>
<pre><code class="bash">alias www='cd /var/www/html'
alias e='cd /mnt/x'</code></pre>
<h4>Relative Jumps</h4>
<p>The above jumps are absolute jumps &#8211; relative jumps are possible too&#8230;</p>
<pre><code class="bash">alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'</code></pre>
<p>Some prefer this syntax&#8230;</p>
<pre><code class="bash">alias ..='cd ..'
alias ..2='cd ../..'
alias ..3='cd ../../..'
alias ..4='cd ../../../..'</code></pre>
<h3>Often Used Commands</h3>
<p>If you use some commands a lot, create smaller alternative for it&#8230;</p>
<pre><code class="bash">alias x='exit'
alias q='exit'
alias rmdir='rm â€“rf'</code></pre>
<p>Many of my own scripts are also alias&#8217;ed this way&#8230;</p>
<pre><code class="bash">alias bk='perl "/home/binnyva/Scripts/Perl/Maintenance/<a href="http://lindesk.com/2008/05/shell-script-to-backup-files-locally-using-rsync/">Rsync Backup/RsyncBackup</a>.pl"'
alias rbk='perl "/home/binnyva/Scripts/Perl/Maintenance/<a href="http://lindesk.com/2008/06/script-to-backup-files-over-a-network-using-rsync/">Rsync Backup/RsyncRemoteBackup</a>.pl"'
alias nbk='perl "/home/binnyva/Scripts/Perl/Maintenance/Rsync Backup/RsyncNetworkBackup.pl"'
alias bdb='perl "/home/binnyva/Scripts/Perl/Maintenance/<a href="http://lindesk.com/2008/06/perl-script-to-backup-mysql-databases/">Database Backup/Dbbackup</a>.pl"'</code></pre>
<h3>Complex Commands</h3>
<p>Create a short version of long and complex command using alias&#8230;</p>
<pre><code class="bash">alias gitstat='git status | perl -pe "exit if(/Untracked files\:/)"'
alias ra='ruby script/server'
alias wikipedia='cd /mnt/x/Data/Wikipedia/mywiki; firefox "http://localhost:8001/"; python manage.py runserver 8001; '
alias sup='svn update'</code></pre>
<p>and more.</p>
<h3>Command Changes</h3>
<p>When I came from Windows to Linux, I was used to the dos commands &#8211; but not to the linux&#8217;s mv,cp commands. So I used to have aliases for those(I don&#8217;t have these now)</p>
<pre><code class="bash">alias move='mv'
alias copy='cp'
alias ren='mv'
alias del='rm'</code></pre>
<p>If you go from Red Hat/Fedora to Debian/Ubuntu(or vise versa), you can set up a few alias to make the change easier&#8230;</p>
<pre><code class="bash">alias yum='apt-get'</code></pre>
<p>You can get a lot of ideas for more aliases by looking at <a href="http://dotfiles.org/.bashrc">others .bashrc files</a>.</p>
<p>Now tell me you aliases&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://lindesk.com/2009/03/customizing-the-terminal-create-useful-aliases/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

