<?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; cli</title>
	<atom:link href="http://lindesk.com/tag/cli/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: 5 Configuration Settings in Bash that makes you a CLI Power User</title>
		<link>http://lindesk.com/2009/04/customize-terminal-configuration-setting-bash-cli-power-user/</link>
		<comments>http://lindesk.com/2009/04/customize-terminal-configuration-setting-bash-cli-power-user/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 19:40:09 +0000</pubDate>
		<dc:creator>BinnyVA</dc:creator>
				<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[power]]></category>
		<category><![CDATA[setting]]></category>
		<category><![CDATA[user]]></category>

		<guid isPermaLink="false">http://lindesk.com/?p=185</guid>
		<description><![CDATA[There are some settings that are very useful if you work on the terminal a lot. Many of the cool ones are not enabled by default - this is a small list of the configuration settings that I use to make my terminal usage more productive.]]></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">There are some settings that are very useful if you work on the terminal a lot. Many of the cool ones are not enabled by default &#8211; this is a small list of the configuration settings that I use to make my terminal usage more productive.</p>
<p>This is part 3 of the Customizing the Terminal series. Already published posts in this series are&#8230;</p>
<ul>
<li><a href="http://lindesk.com/2009/03/customizing-the-terminal-the-prompt/">Customizing the Terminal: The Prompt</a></li>
<li><a href="http://lindesk.com/2009/03/customizing-the-terminal-create-useful-aliases/">Customizing the Terminal: Create Useful Aliases</a></li>
</ul>
<h2>1. Case Correction</h2>
<p>I like to title case my folders and files&#8217; names. The folders in my home are &#8216;Scripts&#8217;, &#8216;Documents&#8217;, &#8216;Temp&#8217; etc. The first character is in upper case. But when I work on the command line, I don&#8217;t always remember to uppercase the first character when trying to cd into a folder. Consequently, the tabbing will not work. Fortunately, there is an option that <strong class="highlight">auto corrects the case</strong> for you. Just open a terminal and type in this command&#8230;</p>
<pre><code class="bash">shopt -s nocaseglob</code></pre>
<p>Other useful shopt option are&#8230;</p>
<dl>
<dt>cdspell</dt>
<dd>Corrects typos in your file/directory name.</dd>
<dt>histappend</dt>
<dd>Makes sure that histories in multiple simultaneous shells don&#8217;t overwrite each other.</dd>
</dl>
<h2>2. Select Which Commands to Store in History</h2>
<p>By default, all commands you type in are stored in the history. You can pick and chose the commands you want to store by putting the option&#8230;</p>
<pre><code class="bash">export HISTCONTROL=ignorespace</code></pre>
<p>in your <code>~/.bash_profile</code> file. This will <strong class="highlight">make sure that bash don&#8217;t store any command beginning with the space character</strong>. So if you want bash to forget that you typed in &#8216;ls&#8217;, just type in &#8216; ls&#8217;(&lt;space&gt;ls).</p>
<h2>3. Don&#8217;t Store Duplicate Commands in your History</h2>
<p>As I said earlier, all commands you type are stored &#8211; even the duplicate ones. You can prevent this by putting this text in your <code>.bash_profile</code> file&#8230;</p>
<pre><code class="bash">export HISTCONTROL=ignoredups</code></pre>
<p>If you want to ignore spaced commands <em>and</em> want to prevent storing of duplicate commands, use the option&#8230;</p>
<pre><code class="bash">export HISTCONTROL=ignoreboth</code></pre>
<h2>4. Auto-complete Command from History</h2>
<p>Picture this &#8211; you type in &#8217;ssh&#8217; and press the &#8216;Page Up&#8217; key &#8211; and <strong class="highlight">bash automatically fetches the last command that starts with ssh</strong> &#8211; and completes the command for you. Well, its possible &#8211; add the following line in your &#8216;.bash_profile&#8217; file&#8230;</p>
<pre><code class="bash">export INPUTRC=$HOME/.inputrc</code></pre>
<p>Now, <strong class="highlight">create a file called <code>.inputrc</code></strong> in your home and enter this into it&#8230;</p>
<pre><code class="bash">#Page up/page down
"\e[5~": history-search-backward
"\e[6~": history-search-forward</code></pre>
<p>Yes, I am aware of the up Ctrl+R trick &#8211; that comes in the next post.</p>
<h2>5. Infinite History</h2>
<p>You can increase or decrease the size of the history by adding this line in the <code>.bash_profile</code> file&#8230;</p>
<pre><code class="bash">export HISTSIZE=500
export HISTFILESIZE=500</code></pre>
<p>This will limit the commands to be stored in the history to 500. If you want to <strong class="highlight">remove the limit use these</strong> lines&#8230;</p>
<pre><code class="bash">unset HISTSIZE
unset HISTFILESIZE</code></pre>
<p>There is a good chance that this will make your history file quite huge &#8211; <strong class="highlight">use with care</strong>.</p>
<p>Please share your configuration settings for bash in the comments.</p>
<h3>Related Links</h3>
<ul>
<li><a href="http://linux.about.com/library/cmd/blcmdl1_shopt.htm">shopt &#8211; Linux Command</a></li>
<li><a href="http://snipplr.com/view/5393/shopt-shell-options/">shopt (shell options) &#8211; Bash</a></li>
<li><a href="http://www.ducea.com/2006/05/15/linux-tips-take-control-of-your-bash_history/">Linux Tips: take control of your bash_history</a></li>
<li><a href="http://www.thegeekstuff.com/2008/08/15-examples-to-master-linux-command-line-history/">15 Examples To Master Linux Command Line History</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://lindesk.com/2009/04/customize-terminal-configuration-setting-bash-cli-power-user/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<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>6</slash:comments>
		</item>
		<item>
		<title>mpg123/mpg321 &#8211; The Command Line MP3 Players</title>
		<link>http://lindesk.com/2008/02/mpg123mpg321-the-command-line-mp3-players/</link>
		<comments>http://lindesk.com/2008/02/mpg123mpg321-the-command-line-mp3-players/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 20:07:20 +0000</pubDate>
		<dc:creator>BinnyVA</dc:creator>
				<category><![CDATA[Audio]]></category>
		<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[mpg123]]></category>
		<category><![CDATA[mpg321]]></category>
		<category><![CDATA[player]]></category>
		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://lindesk.com/2008/02/mpg123mpg321-the-command-line-mp3-players/</guid>
		<description><![CDATA[
So far we looked at the GUI MP3 Players for linux &#8211; like Amarok, Exile, XMMS etc. Most linux users need only that &#8211; but there are some people who want a simpler system &#8211; command line players. The two top players in this area are mpg123 and mpg321.
mpg123
mpg123 is a fast, free, minimalist, console [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://lindesk.com/2008/02/mpg123mpg321-the-command-line-mp3-players/terminal/' rel='attachment wp-att-96' title='Terminal'><img src='http://lindesk.com/wp-content/uploads/2008/02/terminal.png' alt='Terminal' class="intro" align="right" /></a></p>
<p class="intro">So far we looked at the GUI MP3 Players for linux &#8211; like <a href="http://lindesk.com/2007/09/amarok-mp3-player/">Amarok</a>, <a href="http://lindesk.com/2008/01/exaile-music-player-for-gtk/">Exile</a>, <a href="http://lindesk.com/2007/09/xmms-x-multimedia-system/">XMMS</a> etc. Most linux users need only that &#8211; but there are some people who want a simpler system &#8211; command line players. The two top players in this area are mpg123 and mpg321.</p>
<h2>mpg123</h2>
<p>mpg123 is a fast, free, minimalist, console MPEG audio player software program for UNIX and Linux operating systems. The development on this project ceased for a long time &#8211; but now it has a new maintainer.</p>
<ul>
<li><a href="http://www.mpg123.de/">mpg123 Homepage</a></li>
<li><a href="http://en.wikipedia.org/wiki/Mpg123">Wikipedia Page</a></li>
</ul>
<h2>mpg321</h2>
<p>mpg321 is a clone of mpg123. </p>
<ul>
<li><a href="http://mpg321.sourceforge.net/">Homepage</a></li>
<li><a href="http://en.wikipedia.org/wiki/Mpg321">Wikipedia Page</a></li>
</ul>
<h3>Installation</h3>
<p>Most distros have mpg321 in their repositories(not all have mpg123) &#8211; so just log in as root and use these commands to install it&#8230;<br />
<code>yum install mpg321</code> &#8211; For RedHat, Fedora, CentOS etc.<br />
OR<br />
<code>apt-get install mpg321</code> &#8211; For Debian, Ubuntu, etc.</p>
<h3>Using mpg321</h3>
<p>Using mpg321 is straight forward. Since it has no GUI, just go to the folder with the song and just execute the command&#8230;</p>
<pre><code class="cli">mpg321 MP3_FILE_NAME</code></pre>
<p>If you want to play all the songs in a folder, you have to create a list of files in that folder. Then you have to specify this list as an argument for the mpg321 command. These commands can get the job done&#8230;</p>
<p>Create a list of all MP3 Files in the current folder&#8230;</p>
<pre><code class="cli">find . -name "*.mp3"|sed 's/\.\///;'|sort>List.lst</code></pre>
<p>Use this list as the play list for mpg321</p>
<pre><code class="cli">mpg123 --list List.lst</code></pre>
<h3>Why Use Command Line Players?</h3>
<p>If we have a number of shiny GUI players, why should one use a command line player? Unless you are an anti-GUI command line guru, chances are you don&#8217;t need it. But still, it has its uses.</p>
<p>For example, if you have to restart the X Server often for some reason, then mpg321 is the best player for you. All other player will stop playing when X server is down.</p>
<p>This actually happend to me &#8211; when I bought my <a href="http://blog.binnyva.com/2007/10/dual-monitors-the-realization-of-a-dream/">second LCD screen</a>, it took me some time to configure it. And that meant editing the <code>xorg.conf</code> file and restarting the X Server to see if it worked. At that time, I opened a virtual terminal(Ctrl+Alt+F1) and opened mpg321 with a bunch of MP3s in the list. It kept playing even if the X server is down. This is propably the reason that I was still sane after around six hours of XOrg configuration. <img src='http://lindesk.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://lindesk.com/2008/02/mpg123mpg321-the-command-line-mp3-players/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
