<?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>/home/spsneo/blog &#187; Linux</title>
	<atom:link href="http://spsneo.com/blog/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://spsneo.com/blog</link>
	<description>Trying to move every bit to cloud.</description>
	<lastBuildDate>Fri, 19 Aug 2011 16:43:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Post Pidgin and Twitter status from command line</title>
		<link>http://spsneo.com/blog/2010/01/20/post-pidgin-and-twitter-status-from-command-line/</link>
		<comments>http://spsneo.com/blog/2010/01/20/post-pidgin-and-twitter-status-from-command-line/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 11:52:16 +0000</pubDate>
		<dc:creator>spsneo</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[microblogging]]></category>
		<category><![CDATA[Pidgin]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[status message]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://spsneo.com/blog/?p=104</guid>
		<description><![CDATA[I often want to post the same status message in Pidgin and Twitter. I wrote  simple bash script to accomplish this. One can download the script from here: http://www.spsneo.com/scripts/poststatus.tar.gz How to use it - 1) Change the permission of the &#8230; <a href="http://spsneo.com/blog/2010/01/20/post-pidgin-and-twitter-status-from-command-line/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I often want to post the same status message in Pidgin and Twitter. I wrote  simple bash script to accomplish this.</p>
<p>One can download the script from here: <a title="poststatus script" href="http://www.spsneo.com/scripts/poststatus.tar.gz">http://www.spsneo.com/scripts/poststatus.tar.gz</a></p>
<p>How to use it -</p>
<p>1) Change the permission of the file to make it executable: <code> chmod +x poststatus</code></p>
<p>2) Then execute the file with the status message as the argument: <code> ./poststatus "Status Message goes here in quotes"</code></p>
<p>3) The script will first post the status message in your pidgin and will then ask whether you want to post it on twitter.  If you say yes, the script asks you for your twitter username and password.</p>
<p>Start using the script and send me feedback to improve it.</p>
]]></content:encoded>
			<wfw:commentRss>http://spsneo.com/blog/2010/01/20/post-pidgin-and-twitter-status-from-command-line/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Bash History Tips and Tricks</title>
		<link>http://spsneo.com/blog/2009/09/19/bash-history-tips-and-tricks/</link>
		<comments>http://spsneo.com/blog/2009/09/19/bash-history-tips-and-tricks/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 18:48:35 +0000</pubDate>
		<dc:creator>spsneo</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Man pages]]></category>
		<category><![CDATA[History]]></category>

		<guid isPermaLink="false">http://spsneo.com/blog/?p=96</guid>
		<description><![CDATA[Bash supports history expansion feature which can be very useful for powerful command-line users. According to bash manual page - History  expansions introduce words from the history list into the input stream, making it easy to repeat commands, insert the &#8230; <a href="http://spsneo.com/blog/2009/09/19/bash-history-tips-and-tricks/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Bash supports history expansion feature which can be very useful for powerful command-line users.</p>
<p>According to bash manual page -</p>
<blockquote><p>History  expansions introduce words from the history list into the input stream, making it easy to repeat commands, insert the arguments to a previous command into the current input line, or fix errors in previous commands quickly.</p></blockquote>
<p>History expansion is composed of three parts -</p>
<ul>
<li><strong>Event Designators:</strong> It is a reference to an entry in the history list.</li>
<li><strong>Word Designators:</strong> It is used to select a word from the event.</li>
<li><strong>Modifiers:</strong> Modifies the word selected by the word designator or the action of the command.</li>
</ul>
<p>All the three parts are optional and are separated from each other by a : (colon). There can be multiple modifiers each separated by a : (colon).</p>
<p>Now I will explain each part one by one.</p>
<p><strong>Event Designators:</strong></p>
<ol>
<li><strong>! </strong>Start a history substitution, except when followed by a <strong>blank, </strong>newline, carriage return,  = or (</li>
<li><strong>!n </strong>It refers to n&#8217;th command in the history. So if you just type in<br />
<code>!68</code> at the command prompt, 68th command in your history list will be executed.</li>
<li><strong>!-n</strong> It refers to n&#8217;th command in the history from last. So if you just type in !-1 at the command prompt, last command will be executed.<strong> </strong></li>
<li><strong>!!</strong> is an alias for !-1.  Example:<br />
<code>$apt-get install gnome-ppp    //Permission Denied. You need to be sudo to do this!<br />
$sudo !!                      // This is equivalent to sudo apt-get install gnome-ppp</code><strong> </strong></li>
<li><strong>!<span style="text-decoration: underline;">string</span> </strong>It refers to the most recent command in the history starting with <span style="text-decoration: underline;">string</span>. It is again an useful expansion when you don&#8217;t remember the arguments to a command which you have executed earlier.</li>
<li><strong>!?<span style="text-decoration: underline;">string</span>[?] </strong>It refers to the most recent command containing <span style="text-decoration: underline;">string</span>. The trailing <strong>? </strong>may be omitted if <span style="text-decoration: underline;">string</span> is immediately followed by a newline.</li>
</ol>
<p><strong>Word Designators:</strong></p>
<ol>
<li><strong><span style="text-decoration: underline;">n</span> </strong>The <span style="text-decoration: underline;">n</span>th word, count starting from 0. 0th word normally refers to the command. Example:<br />
<code>$sudo cat /etc/resolv.conf     //Instead you want to edit the resolv.conf file<br />
$sudo vi !!:2                       //This is equivalent to sudo vi /etc/resolv.conf</code><strong> </strong></li>
<li><strong> ^ </strong>This refers to 1st word. This is equivalent to <strong>:1 </strong>as refered above. The only .advantage is that you can omit : (colon) when you use ^. Example:<br />
<code> $cat ~/.bashrc<br />
$vi !!^        //This is equivalent to "vi !!:1" that is vi ~/.bashrc<br />
</code></li>
<li>$ This refers to the last word.</li>
<li><span style="text-decoration: underline;"><strong>x</strong></span><strong>-<span style="text-decoration: underline;">y</span> </strong>This refers to a range of words; &#8216;<strong>-<span style="text-decoration: underline;">y</span></strong>&#8216; is equivalent to &#8217;0-y&#8217;.</li>
<li><strong>* </strong>This refers to all the words except the 0th one. This is helpful when you have to execute a command with all the arguments passed to the last command.</li>
<li><span style="text-decoration: underline;"><strong>x</strong></span><strong>* </strong>This is an alias for <span style="text-decoration: underline;">x</span>-$ .</li>
</ol>
<p>Note: If a word designator is used without an event specification, the last command in the history is used as the event. Example -<br />
<code>$cat ~/.bashrc<br />
$vi !:1</code> // This is equivalent to vi !!:1 or vi ~/.bashrc</p>
<p><strong>Modifiers:</strong></p>
<ol>
<li><strong>h</strong> This removes the trailing file name component, leaving the head. Example:<br />
<code>$cat /home/spsneo/.bashrc<br />
$ls !!:1:h </code>//This expands to <code>ls /home/spsneo</code>Explanation: !! refers to the last command and then :1 refers to the 1st word of the last command and then :h removes the trailing file name component i.e., .bashrc . Hence the expansion.</li>
<li><strong>t</strong> This removes all leading file name components, leaving the tail.</li>
<li><strong>r </strong>This removes the trailing suffix of the form <span style="text-decoration: underline;"><strong>.xxx</strong></span> , leaving the basename.</li>
<li><strong>p </strong>Print the new command but do not execute it.</li>
<li><strong>s/<span style="text-decoration: underline;">old</span>/<span style="text-decoration: underline;">new</span></strong> This substitutes the first occurrence of <span style="text-decoration: underline;">old</span> with <span style="text-decoration: underline;">new</span>. Example:<br />
<code>$cat /etc/resolv.conf<br />
$!!:s/resolv/yum</code> //This expands to <code>cat /etc/yum.conf</code><strong><code><br />
</code></strong></li>
<li><strong>g </strong>This is used in conjunction with &#8220;<strong>:s</strong>&#8221; modifier. This causes changes to be applied over the entire event line rather than just the first occurrence. Example:<br />
<code>$cat test.cpp test.h<br />
$!!:gs/test/source/ </code> //This expands to <code>cat source.cpp source.hh</code></li>
</ol>
<p>This is all I have to share about bash history expansion.</p>
<p>Do post comments if you find any mistake or if you want any further clarifications. One can also go through the bash manual pages for more options.</p>
]]></content:encoded>
			<wfw:commentRss>http://spsneo.com/blog/2009/09/19/bash-history-tips-and-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Set BING Background as your Desktop Wallpaper in GNOME</title>
		<link>http://spsneo.com/blog/2009/07/18/set-bing-background-as-your-desktop-wallpaper-in-gnome/</link>
		<comments>http://spsneo.com/blog/2009/07/18/set-bing-background-as-your-desktop-wallpaper-in-gnome/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 20:15:01 +0000</pubDate>
		<dc:creator>spsneo</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[BING]]></category>
		<category><![CDATA[GNOME]]></category>
		<category><![CDATA[GRUB]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Wallpaper]]></category>

		<guid isPermaLink="false">http://spsneo.com/blog/?p=86</guid>
		<description><![CDATA[BING comes up with a beautiful background everyday. I thought why not set this background as my desktop wallpaper. But it would be a cumbersome task to set it manually. So I searched (Googled, BINGed) for some script which will &#8230; <a href="http://spsneo.com/blog/2009/07/18/set-bing-background-as-your-desktop-wallpaper-in-gnome/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a title="BING " href="http://www.bing.com" target="_blank">BING</a> comes up with a beautiful background everyday. I thought why not set this background as my desktop wallpaper. But it would be a cumbersome task to set it manually. So I searched (Googled, BINGed) for some script which will do this for me. I found <a title="Bing Downloader" href="http://bing.codeplex.com/" target="_blank">BING Downloader</a> which does this task on Windows. I could not find any such script for GNOME. So, I thought of writing one.</p>
<p>I wrote a script which when executed automatically sets the GNOME wallpaper as BING background of the day. This is a PHP script. To execute this script you need to have php installed on your system. You can install php in Ubuntu as<br />
<code><br />
sudo apt-get install php5 php5-cli</code></p>
<p>Now you are all set to download this script. Download Link: <a title="Set BING background as GNOME Desktop wallpaper" href="http://www.spsneo.com/scripts/bing_wallpaper.tar.gz" target="_self">http://www.spsneo.com/scripts/bing_wallpaper.tar.gz</a></p>
<p>Download this file, extract the script file. Now you can run the script from terminal :<br />
<code> php bing_wallpaper.php </code></p>
<p>And your wallpaper is set. You can run this script daily from your terminal or you can set a cron job for the same or you can set up an icon in your gnome panel for this script.</p>
<p>I will keep updating this script. And I am also planning to write the same script in python. So check back again if you dont want to install php on your system.</p>
<p>Send your feedbacks and suggestions.</p>
<p><strong>Update 1:</strong> I have modified the script to work with http proxy. Just assure that the environment variable http_proxy is properly set.</p>
<p><strong>Update 2:</strong> Modified the script to keep the image centered on the desktop with black background. Try it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://spsneo.com/blog/2009/07/18/set-bing-background-as-your-desktop-wallpaper-in-gnome/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Open any file from terminal in Gnome</title>
		<link>http://spsneo.com/blog/2009/04/05/open-any-file-from-terminal-in-gnome/</link>
		<comments>http://spsneo.com/blog/2009/04/05/open-any-file-from-terminal-in-gnome/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 05:34:15 +0000</pubDate>
		<dc:creator>spsneo</dc:creator>
				<category><![CDATA[GNOME]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://spsneo.com/blog/?p=83</guid>
		<description><![CDATA[I normally use terminals to navigate through directories in my computer. I often have to remember the executable filename of different applications to open files. Like to open a pdf file I have to remember evince, for an audio or &#8230; <a href="http://spsneo.com/blog/2009/04/05/open-any-file-from-terminal-in-gnome/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I normally use terminals to navigate through directories in my computer. I often have to remember the executable filename of different applications to open files. Like to open a pdf file I have to remember evince, for an audio or video file &#8211; vlc. But its really difficult to remember executable filenames for all types of files. For example I don&#8217;t remember how to open a .xls file from command line.</p>
<p>There&#8217;s a command which open files using GNOME file handlers &#8211; &#8220;gnome-open&#8221;. Now, when I have to open any file I just type in &#8220;gnome-open &lt;filename&gt;&#8221;. Simple !</p>
<p>To make things more simple I have made an alias &#8216;go&#8217; for &#8216;gnome-open&#8217;. Now opening a file from terminal is as easy as typing &#8220;go &lt;filename&gt;&#8221; in terminal.</p>
]]></content:encoded>
			<wfw:commentRss>http://spsneo.com/blog/2009/04/05/open-any-file-from-terminal-in-gnome/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Extract all Archive File Format With Just One Command in Linux</title>
		<link>http://spsneo.com/blog/2009/01/28/extract-all-archive-file-forma-with-just-one-command-in-linux/</link>
		<comments>http://spsneo.com/blog/2009/01/28/extract-all-archive-file-forma-with-just-one-command-in-linux/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 18:50:15 +0000</pubDate>
		<dc:creator>spsneo</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[archive file]]></category>

		<guid isPermaLink="false">http://spsneo.com/blog/?p=79</guid>
		<description><![CDATA[There are large number of archive file formats &#8211; .zip, .tar.gz, .tar, .gz, .7zip, .rar, etc etc.. I find it difficult to remember the command line options for extracting different archive file formats. So, I wrote a bash function which &#8230; <a href="http://spsneo.com/blog/2009/01/28/extract-all-archive-file-forma-with-just-one-command-in-linux/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There are large number of archive file formats &#8211; .zip, .tar.gz, .tar, .gz, .7zip, .rar, etc etc..</p>
<p>I find it difficult to remember the command line options for extracting different archive file formats. So, I wrote a bash function which given a archive filename as an input extracts it.</p>
<p>Here&#8217;s the function :<br />
<code><br />
extract () {<br />
if [ -f $1 ] ; then<br />
case $1 in<br />
*.tar.bz2)      tar xjf $1      ;;<br />
*.tar.gz)        tar xzf $1      ;;<br />
*.bz2)           bunzip2 $1      ;;<br />
*.rar)             rar x $1          ;;<br />
*.gz)             gunzip $1               ;;<br />
*.tar)            tar xf $1               ;;<br />
*.tbz2)          tar xjf $1      ;;<br />
*.tgz)            tar xzf $1      ;;<br />
*.zip)             unzip $1                ;;<br />
*.z)               uncompress $1   ;;<br />
*)                  echo "'$1' cannot be extracted via extract ()"          ;;<br />
esac<br />
else<br />
echo "'$1' is not a valid file"<br />
fi<br />
}</code></p>
<p>This function is pretty self explanatory. But as it is not powerful. It becomes the ultimate tool for extractive archive files if you copy this function in you bashrc file (~/.bashrc).</p>
<p>Now you can simply extract any file like this:</p>
<p><code><br />
$extract test.tar.gz</code></p>
<p>Hope you like this function.</p>
<p>Note: This function doesn&#8217;t work with files have space in its name. I didn&#8217;t waste time in solving this issue as I normally don&#8217;t use such filenames. If any of you solve this issue, please do let me know. I would include it with your name in this post. <img src='http://spsneo.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://spsneo.com/blog/2009/01/28/extract-all-archive-file-forma-with-just-one-command-in-linux/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Directory Navigation Tips in Linux</title>
		<link>http://spsneo.com/blog/2008/10/07/directory-navigation-tips-in-linux/</link>
		<comments>http://spsneo.com/blog/2008/10/07/directory-navigation-tips-in-linux/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 11:29:12 +0000</pubDate>
		<dc:creator>spsneo</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[File System]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://spsneo.com/blog/?p=64</guid>
		<description><![CDATA[Many of us just use cd, cd .., cd &#60;dir&#62; to navigate through the file system in Linux. Directory or file-system navigation can be simplified by using following commands - 1) Many times we are in some directory say /home/user/foo &#8230; <a href="http://spsneo.com/blog/2008/10/07/directory-navigation-tips-in-linux/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Many of us just use cd, cd .., cd &lt;dir&gt; to navigate through the file system in Linux. Directory or file-system navigation can be simplified by using following commands -</p>
<p>1) Many times we are in some directory say /home/user/foo and we need to go to the directory /usr/share/bar . After completing tasks in this directory, if one needs to get back to the previous directory, he would type in &#8216;cd /home/user/foo&#8217; . Won&#8217;t it be far easy if we had some kind of back button as in Nautilus or Windows Explorer ? Its already there in Linux. Just type in<br />
<code> $ cd -</code><br />
and you will reach back to the previous directory.</p>
<p>2) Another important tool to make navigation easier is &#8216;pushd&#8217; and &#8216;popd&#8217;. Say you are in some directory /home/user/foo1 and then you wish to navigate to /home/user/foo2 and then to /home/user/foo3<br />
After all these you need to back to previous directories. You can use pushd and popd like this :<br />
<code><br />
$ pwd<br />
/home/user/foo1<br />
$ pushd .<br />
$ cd /home/user/foo2<br />
$ pushd .<br />
$ cd /home/user/foo3</code></p>
<p>Now to get back to previous directories -<br />
$ popd<br />
$ pwd<br />
/home/user/foo2</p>
<p>pushd actually push its argument directory to a stack and popd changes the current directory to the one on top of the stack.</p>
<p>Hope you enjoyed these tips.</p>
]]></content:encoded>
			<wfw:commentRss>http://spsneo.com/blog/2008/10/07/directory-navigation-tips-in-linux/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Reusing SSH connection</title>
		<link>http://spsneo.com/blog/2008/08/25/reusing-ssh-connection/</link>
		<comments>http://spsneo.com/blog/2008/08/25/reusing-ssh-connection/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 14:21:15 +0000</pubDate>
		<dc:creator>spsneo</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[Connection]]></category>
		<category><![CDATA[Socket]]></category>

		<guid isPermaLink="false">http://spsneo.com/blog/?p=45</guid>
		<description><![CDATA[Very often, while working on a network node via SSH, we need multiple connections to the same node. For example, say you are connected to a node A, and then you need to transfer a file to the same node &#8230; <a href="http://spsneo.com/blog/2008/08/25/reusing-ssh-connection/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Very often, while working on a network node via SSH, we need multiple connections to the same node. For example, say you are connected to a node A, and then you need to transfer a file to the same node from your local machine. Then we have to <strong><em>scp</em></strong>, which establishes a fresh connection to that machine and one has to enter the password again. So, it takes some time as well as it is irritating to enter password again and again.</p>
<p>Here&#8217;s the remedy :</p>
<p>Open the file  /etc/ssh/ssh_config  on your local machine as root to edit. Or if you are not the root user, you can create a file  ~/.ssh/config  for user level SSH configurations.</p>
<p>Add the following lines at the end of the file you opened just now:</p>
<p><code> ControlMaster auto </code><br />
<code> ControlPath /tmp/ssh-%r@%h:%p </code></p>
<p>Save the file and you are done !!</p>
<p>Now check out (One can try it this way) -Open a terminal and connect to a server :</p>
<p><code> $ ssh s.siddharth@202.141.81.145 </code></p>
<p>The connection gets established after entering the proper password. </p>
<p>Then in another terminal try to copy a file from your local machine to the same server :</p>
<p><code> $ scp -r ~/pintos s.siddharth@202.141.81.145 </code></p>
<p>This time, you don&#8217;t need to wait for a fresh connection, neither you will have to enter the password again. File transfer starts instantaneously. SSH shared the already established connection.<br />
Similarly you can open another terminal without waiting and entering the password again. </p>
<p>One can check out more configurations for SSH by checking out the man pages of ssh_config<br />
<code>$ man ssh_config </code></p>
<p>Hope you liked this tip !!</p>
]]></content:encoded>
			<wfw:commentRss>http://spsneo.com/blog/2008/08/25/reusing-ssh-connection/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Download Files Larger Than The Download Limit</title>
		<link>http://spsneo.com/blog/2008/08/18/download-files-larger-than-the-download-limit/</link>
		<comments>http://spsneo.com/blog/2008/08/18/download-files-larger-than-the-download-limit/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 18:11:11 +0000</pubDate>
		<dc:creator>spsneo</dc:creator>
				<category><![CDATA[curl]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[download]]></category>

		<guid isPermaLink="false">http://spsneo.com/blog/?p=34</guid>
		<description><![CDATA[Yesterday I had to download a file of size 232 MB. As I connect to the Internet via proxy and the authorities have restricted the file size download limit to 150 MB, I had to find some alternative. Similar scenarios &#8230; <a href="http://spsneo.com/blog/2008/08/18/download-files-larger-than-the-download-limit/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Yesterday I had to download a file of size 232 MB. As I connect to the Internet via proxy and the authorities have restricted the file size download limit to 150 MB, I had to find some alternative. Similar scenarios are there in almost all Educational Institutions.</p>
<p>I was searching for the solution, somebody told me about JGet (a Multithreaded Java Software), but it hogs up a lot of system resources. I was in search of an alternate solution, then somebody on ##linux in irc.freenode.net told me about curl. Though I had heard of it earlier as well and I used it to automate web browsing like posting form data etc. But this time when I went through the man pages of curl, I realized how powerful is curl.</p>
<p>There are hundreds of options for CURL. I will just demonstrate you the one option which can help you download files of almost any size.</p>
<p>Lets start off&#8230;</p>
<p>In this example I am trying to download 32 Bit Fedora Live CD iso image. In this example, what we will do is download a part of file in one connection. After downloading all files we will concatenate them. This is what almost any Download manager software does.</p>
<p>To download a part of file theres an option <code>-r/ --range</code> available in curl which lets us specify the range of bytes of the file to be downloaded.</p>
<p>Range can be specified in following ways :<br />
<code> curl -r 0-499 </code><br />
This specifies to download first 500 bytes<br />
<code> curl -r 500-999 </code><br />
This specifies to download bytes starting from 500 to 999.<br />
<code> curl -r -500 </code><br />
specifies to download last 500 bytes.<br />
<code> curl -r 500- </code><br />
specifies to download the bytes from offset 500 and forward</p>
<p>There are few more options. Check out the man pages. ( I have copied the simple options here).</p>
<p>Now here I have to download Fedora live CD iso which is 691 MB in size. So, I will download 100 MB in each connection, like this:<br />
<code> curl -# -r 0-99999999 -o fedora.iso.part1 http://download.fedoraproject.org/pub/fedora/linux/releases/9/Live/i686/Fedora-9-i686-Live.iso  &amp;</code></p>
<p><code> curl -# -r 100000000-199999999 -o fedora.iso.part2 http://download.fedoraproject.org/pub/fedora/linux/releases/9/Live/i686/Fedora-9-i686-Live.iso &amp; </code></p>
<p><code> curl -# -r 200000000-299999999 -o fedora.iso.part3 http://download.fedoraproject.org/pub/fedora/linux/releases/9/Live/i686/Fedora-9-i686-Live.iso &amp;</code></p>
<p><code> curl -# -r 300000000-399999999 -o fedora.iso.part4 http://download.fedoraproject.org/pub/fedora/linux/releases/9/Live/i686/Fedora-9-i686-Live.iso &amp;</code></p>
<p><code> curl -# -r 400000000-499999999 -o fedora.iso.part5 http://download.fedoraproject.org/pub/fedora/linux/releases/9/Live/i686/Fedora-9-i686-Live.iso &amp;</code></p>
<p><code> curl -# -r 500000000-599999999 -o fedora.iso.part6 http://download.fedoraproject.org/pub/fedora/linux/releases/9/Live/i686/Fedora-9-i686-Live.iso &amp;</code></p>
<p><code> curl -# -r 600000000- -o fedora.iso.part7 http://download.fedoraproject.org/pub/fedora/linux/releases/9/Live/i686/Fedora-9-i686-Live.iso &amp;</code></p>
<p>In the above code -# is to suppress the details of progress meter. You can ignore this option.</p>
<p>After all the files are downloaded, we need to concatenate them. This is quite simple.</p>
<p><code> $ cat fedora.iso.part? &gt; fedora-9-live.iso</code><br />
And your live CD iso image is ready as fedora-9-live.iso<br />
To verify the file has been downloaded and concatenated correctly you may verify the checksums before burning it to a CD/DVD.</p>
<p>This process could be automated if somehow by a simple shell script if we could get the file size before starting the downloaded. To accomplish this, I once again went through the man pages. And I found a useful option <code> -I/ --head </code>. This option fetches the HTTP-header  only. One can easily get the file size as Content-Length from the HTTP headers. But, when I tried this through proxy servers I got a X-Squid-Error: ERR_TOO_BIG , so couldn&#8217;t determine the correct file size. And hence I am unable to automate the process. Anybody, any help ?? (please post it as comment).</p>
<p>Happy Downloading !!</p>
]]></content:encoded>
			<wfw:commentRss>http://spsneo.com/blog/2008/08/18/download-files-larger-than-the-download-limit/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Random Wallpapers in Gnome</title>
		<link>http://spsneo.com/blog/2008/08/09/random-wallpapers-in-gnome/</link>
		<comments>http://spsneo.com/blog/2008/08/09/random-wallpapers-in-gnome/#comments</comments>
		<pubDate>Sat, 09 Aug 2008 14:03:38 +0000</pubDate>
		<dc:creator>spsneo</dc:creator>
				<category><![CDATA[GNOME]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Wallpaper]]></category>

		<guid isPermaLink="false">http://spsneo.com/blog/?p=29</guid>
		<description><![CDATA[There are many softwares in Windows(TM) which changes the wallpaper randomly from a given set of images. I was thinking of this for my Linux machine. I came up with a shell script. Though there can be many other ways. &#8230; <a href="http://spsneo.com/blog/2008/08/09/random-wallpapers-in-gnome/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There are many softwares in Windows(TM) which changes the wallpaper randomly from a given set of images. I was thinking of this for my Linux machine. I came up with a shell script. Though there can be many other ways. I just wanted to share my script and nothing else.</p>
<p><strong>Update: There&#8217;s a tool which does all this automatically. drapes in Universe repository</strong></p>
<p>Here in this code I am assuming that you have got all your wallpaper images in the directory <em>/home/username/Pictures</em> . You have to replace this directory with your wallpaper directory.</p>
<p>Here goes the code :<br />
<code><br />
#! /bin/bash<br />
wallpaper_folder=/home/username/Pictures<br />
wallpaper_array=($wallpaper_folder/*.jpg)<br />
number=${#wallpaper_array[*]}<br />
((number=RANDOM%number))<br />
random_wallpaper=${wallpaper_array[$number]}<br />
<code>gconftool-2 --type string --set /desktop/gnome/background/picture_filename "$random_wallpaper"</code><br />
</code></p>
<p>Well, so let us quickly analyze the code. First line is the famous &#8216;sha-bang&#8217;.</p>
<p>In the second line I am just setting the path of the wallpaper folder to the variable wallpaper_folder.</p>
<p>Third line I am creating an array containing all the file names with the extension jpg in the directory &#8216;wallpaper_folder&#8217; (spaces are being escaped). More about bash arrays <a title="bash arrays" href="http://tldp.org/LDP/abs/html/arrays.html">here</a>.</p>
<p>Fourth line, I am calculating the number of elements in the array. This is the standard method of calculating the number of elements in a bash array. (replacing # with @ will also work fine).</p>
<p>Then in the fifth line, random number is generated within the range 0 to &#8216;number&#8217;. More about random numbers in bash <a title="random numbers in bash" href="http://tldp.org/LDP/abs/html/randomvar.html">here</a>.</p>
<p>Sixth line set the variable random_wallpaper to the value corresponding to the key &#8216;number&#8217; in the array wallpaper_array.</p>
<p>Seventh line, finally sets the file &#8216;random_wallpaper&#8217; as the wallpaper. gconftool-2 is used to do customization in GNOME settings. Check out the man pages of gconftool-2 to know more about it. There&#8217;s a GUI tool for this gconftool-2 : gconf-editor</p>
<p>Now this script just sets the wallpaper randomly from a given set of images. Now you can schedule this script using cron to execute it at some regular interval. (In case you dont know what is cron, check out the manual pages of cron and crontab).</p>
]]></content:encoded>
			<wfw:commentRss>http://spsneo.com/blog/2008/08/09/random-wallpapers-in-gnome/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>VLC: Command Line Interface</title>
		<link>http://spsneo.com/blog/2008/08/05/vlc-command-line-interface/</link>
		<comments>http://spsneo.com/blog/2008/08/05/vlc-command-line-interface/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 12:11:25 +0000</pubDate>
		<dc:creator>spsneo</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[vlc]]></category>

		<guid isPermaLink="false">http://spsneo.com/blog/?p=28</guid>
		<description><![CDATA[This post is for those who love to work out everything from the terminal. Ever wondered how to play media files (audio or video) from the terminal ?? Check out !! First a screenshot : In this post I assume &#8230; <a href="http://spsneo.com/blog/2008/08/05/vlc-command-line-interface/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This post is for those who love to work out everything from the terminal. Ever wondered how to play media files (audio or video) from the terminal ?? Check out !! First a screenshot :</p>
<p><a href="http://spsneo.com/images/vlc.jpg"><img src="http://spsneo.com/images/vlc.jpg" alt="vlc comman line" /></a></p>
<p>In this post I assume you are using Linux with VLC installed. VLC has a very simple GUI with lots of functionality. It also has an equally powerful command line ncurses interface. You can open this interface by typing in the terminal :</p>
<p>$ vlc -I ncurses</p>
<p>Now press &#8216;h&#8217; to explore the help.</p>
<p>Let me show some usage. Say you have some mp3 files in ~/Music and you want to add all these mp3 files in playlist. You need to type in the terminal :</p>
<p>$ vlc -I ncurses ~/Music/*.mp3</p>
<p>And you will find all these files in the playlist.</p>
<p>There are a plenty of options like you can increase volume by pressing &#8216;a&#8217; and decrease volume by &#8216;z&#8217;. For loads of other options press &#8216;h&#8217; and browse through the help.</p>
<p>Keep rocking !</p>
]]></content:encoded>
			<wfw:commentRss>http://spsneo.com/blog/2008/08/05/vlc-command-line-interface/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

