<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Command Line on Amit Agarwal Linux Blog</title>
    <link>/tags/command-line/</link>
    <description>Recent content in Command Line on Amit Agarwal Linux Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Thu, 24 Jun 2010 20:51:30 +0000</lastBuildDate>
    
	<atom:link href="/tags/command-line/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Check file usage using fuser</title>
      <link>/2010/06/25/check-file-usage-using-fuser/</link>
      <pubDate>Thu, 24 Jun 2010 20:51:30 +0000</pubDate>
      
      <guid>/2010/06/25/check-file-usage-using-fuser/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;There is a package called psmisc that provides a useful application fuser. The package provides the below (on fedora):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;/sbin/fuser&lt;br&gt;
/usr/bin/killall&lt;br&gt;
/usr/bin/peekfd&lt;br&gt;
/usr/bin/pstree&lt;br&gt;
/usr/bin/pstree.x11&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;There are couple of options you can provide on the terminal to fuser. The main purpose of the binary is to check the process id of the process using the file. This can be useful if some file operation on a file is blocking something for you 🙂&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>email with templates (with variables) from the command line with sendmail or any other MTA.</title>
      <link>/2010/06/09/email-with-templates-with-variables-from-the-command-line-with-sendmail-or-any-other-mta/</link>
      <pubDate>Wed, 09 Jun 2010 16:57:10 +0000</pubDate>
      
      <guid>/2010/06/09/email-with-templates-with-variables-from-the-command-line-with-sendmail-or-any-other-mta/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;I was trying to get templates to work on evolution and found that although templates are there in evolution mail client, its not that efficient to use. What I thus wanted was to have something that could allow me to send mails to (and cc and bcc) to specified people with predefined template, only some values changed, like changelog and so on. So I wrote a set of files and below files to achieve the same. Hope it helps you too 🙂&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Logwatch for Linux Systems.</title>
      <link>/2010/06/02/logwatch-for-linux-systems/</link>
      <pubDate>Wed, 02 Jun 2010 01:53:36 +0000</pubDate>
      
      <guid>/2010/06/02/logwatch-for-linux-systems/</guid>
      <description>&lt;p&gt;On my personal &amp;lt;a class=&amp;quot;zem_slink freebase/en/client&amp;quot; title=&amp;quot;Client (computing)&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Client_%28computing%29&amp;quot;&amp;gt;desktop&lt;/a&gt; at home, I like to see the &amp;lt;a class=&amp;quot;zem_slink freebase/en/statistics&amp;quot; title=&amp;quot;Statistics&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Statistics&amp;quot;&amp;gt;statistics&lt;/a&gt; at least once a day, for what was installed, what was run with &amp;lt;a class=&amp;quot;zem_slink freebase/en/sudo&amp;quot; title=&amp;quot;Sudo&amp;quot; rel=&amp;quot;homepage&amp;quot; href=&amp;quot;http://www.sudo.ws/&amp;quot;&amp;gt;sudo&lt;/a&gt; and other such details like &amp;lt;a class=&amp;quot;zem_slink freebase/en/kernel&amp;quot; title=&amp;quot;Kernel (computing)&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Kernel_%28computing%29&amp;quot;&amp;gt;kernel&lt;/a&gt; errors.&lt;/p&gt;
&lt;p&gt;Running this monotonously every day is quite boring, so comes to rescue is logwatch. I have &amp;lt;a class=&amp;quot;zem_slink freebase/en/fedora&amp;quot; title=&amp;quot;Fedora&amp;quot; rel=&amp;quot;homepage&amp;quot; href=&amp;quot;http://fedoraproject.org/&amp;quot;&amp;gt;Fedora&lt;/a&gt; &amp;lt;a class=&amp;quot;zem_slink freebase/en/installation&amp;quot; title=&amp;quot;Installation (computer programs)&amp;quot; rel=&amp;quot;wikipedia&amp;quot; href=&amp;quot;http://en.wikipedia.org/wiki/Installation_%28computer_programs%29&amp;quot;&amp;gt;installation&lt;/a&gt; so I will talk about the location with respect to that so for your distribution it might be a little different.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>command line cheat sheet for begineers.</title>
      <link>/2010/05/17/command-line-cheat-sheet-for-begineers/</link>
      <pubDate>Mon, 17 May 2010 15:59:22 +0000</pubDate>
      
      <guid>/2010/05/17/command-line-cheat-sheet-for-begineers/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;A list of commands with some examples posted by Ian &amp;lt;a href=&amp;quot;http://ardchoille42.blogspot.com/2009/08/command-line-cheatsheet.html&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;here&lt;/a&gt;. Looks good for new comers to Linux OS 🙂&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Get the most favourite commands from commandlinefu</title>
      <link>/2010/05/12/get-the-most-favourite-commands-from-commandlinefu/</link>
      <pubDate>Wed, 12 May 2010 17:01:22 +0000</pubDate>
      
      <guid>/2010/05/12/get-the-most-favourite-commands-from-commandlinefu/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;For those of you who don&amp;amp;#8217;t know, commandlinefu should be one place you should watch to learn new things for command line. Everyday a lot of people post commands to better the previously posted commands. If you want to get the best voted commands from the archieves of commandlinefu then you can use the command:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;curl -O &amp;amp;#8221;&amp;lt;a rel=&amp;quot;nofollow&amp;quot; href=&amp;quot;http://www.commandlinefu.com/commands/browse/sort-by-votes/plaintext/%5B0-2400:25%5D&amp;quot;&amp;gt;http://www.commandlinefu.com/commands/browse/sort-by-votes/plaintext/[0-2400:25]&lt;/a&gt;&amp;amp;#8221;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Suggested by &lt;strong&gt;Dynetrekk&lt;/strong&gt; ****&amp;lt;a href=&amp;quot;http://www.commandlinefu.com/commands/view/2740/get-all-these-commands-in-a-text-file-with-description&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;here&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Download with browse with bash and wget</title>
      <link>/2010/05/09/download-with-browse-with-bash-and-wget/</link>
      <pubDate>Sun, 09 May 2010 13:34:18 +0000</pubDate>
      
      <guid>/2010/05/09/download-with-browse-with-bash-and-wget/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Been pretty busy for last couple of days. Will be busy for another few days, but here&amp;amp;#8217;s something to munch in the meantime (Script may need changes depending on the type of file you want to download or the site you are browsing, but the chnages should be minimal):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;file=&amp;amp;#8221;/tmp/temp.dir&amp;amp;#8221;&lt;br&gt;
url=&amp;amp;#8221;URL Here&amp;amp;#8221;&lt;br&gt;
IFS=&amp;amp;#8217;&lt;br&gt;
&amp;amp;#8217;&lt;br&gt;
cont=&amp;amp;#8221;y&amp;amp;#8221;&lt;br&gt;
while [ $cont != &amp;amp;#8221;n&amp;amp;#8221; ]&lt;br&gt;
do&lt;br&gt;
name=&amp;amp;#8221;&amp;amp;#8221;&lt;br&gt;
wget &amp;amp;#8221;$url&amp;amp;#8221; -O $file -o /dev/null&lt;br&gt;
for i in $(grep href $file |grep -v Parent)&lt;br&gt;
do&lt;br&gt;
name=${i##&lt;em&gt;href=&amp;amp;#8221;}&lt;br&gt;
name=${name%%&amp;amp;#8221;&amp;gt;&lt;/em&gt;}&lt;br&gt;
echo $name&lt;br&gt;
if [[ $name == *gz ]]&lt;br&gt;
then&lt;br&gt;
cont=&amp;amp;#8221;n&amp;amp;#8221;&lt;br&gt;
fi&lt;br&gt;
done&lt;br&gt;
if [ ! $name ]&lt;br&gt;
then&lt;br&gt;
echo &amp;amp;#8221;No files here.. Exiting&amp;amp;#8221;&lt;br&gt;
exit -1&lt;br&gt;
fi&lt;br&gt;
echo&lt;br&gt;
if [ $cont == &amp;amp;#8221;n&amp;amp;#8221; ]&lt;br&gt;
then&lt;br&gt;
echo &amp;amp;#8221;Enter the filename for download :&amp;amp;#8221;&lt;br&gt;
read file&lt;br&gt;
fi&lt;br&gt;
echo &amp;amp;#8221;Select one of the options:&amp;amp;#8221;&lt;br&gt;
read product&lt;br&gt;
url=&amp;amp;#8221;$url/$product&amp;amp;#8221;&lt;br&gt;
echo &amp;amp;#8221;About to get $url&amp;amp;#8221;&lt;br&gt;
done&lt;br&gt;
wget &amp;amp;#8221;$url&amp;amp;#8221; -O $file -o /dev/null&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>unbound variable – bash completion not working and having issues with other stuff like command not found.</title>
      <link>/2010/03/23/unbound-variable-bash-completion-not-working-and-having-issues-with-other-stuff-like-command-not-found/</link>
      <pubDate>Tue, 23 Mar 2010 03:29:09 +0000</pubDate>
      
      <guid>/2010/03/23/unbound-variable-bash-completion-not-working-and-having-issues-with-other-stuff-like-command-not-found/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;I generally use vi/vim for all my practical purposes of working with text files. And I have all the vi/vim plugins required to work with the files. This causes the following to be in the skeleton for all the bash scripts that I create:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;set -o nounset                              # Treat unset variables as an error&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;With this all the unbound variables as errors and was problem with all the shell scripts that was being sourced in the startup of bash. So all I had to do was remove this from all the startup scripts and then from the skeleton of the bash script in vim :).&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Execute mysql command from shell</title>
      <link>/2010/02/04/execute-mysql-command-from-shell/</link>
      <pubDate>Thu, 04 Feb 2010 15:58:37 +0000</pubDate>
      
      <guid>/2010/02/04/execute-mysql-command-from-shell/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;phpMyAdmin is a very slow application if you want to execute a query on your database. If you know the name of the database then any GUI tool is an overhead. So I have written a one liner shell script to do that for me 🙂&lt;/p&gt;
&lt;p&gt;Here&amp;amp;#8217;s the script:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;echo &amp;amp;#8221;select * from table where field like &amp;amp;#8221;%$1%&amp;amp;#8221;&amp;amp;#8221;|mysql -h doamin.com -u amit -p -D amit -r –password=hello&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;When run with one argument it will execute the sql query directly without asking for password also.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>shell — one liner to selectively change case</title>
      <link>/2010/01/07/shell-one-liner-to-selectively-change-case/</link>
      <pubDate>Thu, 07 Jan 2010 02:31:15 +0000</pubDate>
      
      <guid>/2010/01/07/shell-one-liner-to-selectively-change-case/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;Today I had a hard time, I had a herculian task of converting the case of file to upper case. Well that&amp;amp;#8217;s not difficult :), I know. What made it difficult was the fact that not the whole file had to be converted but only selective lines containing the work important. Okay now that too is not so difficult, I thought. But again the file size was huge, it had some 9 million lines. So, I just thought of trying my skills of shell programming (dont have much of it anyway). So here&amp;amp;#8217;s what I did:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>feh – versatile image viewer works from command line too.</title>
      <link>/2009/11/21/feh-versatile-image-viewer-works-from-command-line-too/</link>
      <pubDate>Sat, 21 Nov 2009 02:13:27 +0000</pubDate>
      
      <guid>/2009/11/21/feh-versatile-image-viewer-works-from-command-line-too/</guid>
      <description>&lt;!--[ad#ad-2]--&gt;
&lt;p&gt;To install :&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;sudo yum install feh&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;From the info for the feh package:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;feh – versatile image viewer works from command line too&lt;br&gt;
premier image file handling library. feh has many features,&lt;br&gt;
from simple single file viewing, to multiple file modes using&lt;br&gt;
a slideshow or multiple windows. feh supports the creation of&lt;br&gt;
montages as index prints with many user-configurable options.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;One of the reasons, I install feh as one of the first packages on any installation is the reason that it can open multiple images like in stack. To make things even more simpler I create a alias like this:&lt;/p&gt;</description>
    </item>
    
  </channel>
</rss>
