bash regular expressions

2011-02-06 1 min read Bash

Here are some quick links on bash regular expressions, pretty good links to bookmark, if you use, regular expressions in bash regularly. I especially like the tldp link at number 3.

http://www.linuxjournal.com/content/bash-regular-expressions
http://www.ibm.com/developerworks/library/l-bash.html
http://tldp.org/LDP/abs/html/parameter-substitution.html#VARMATCH
http://wellington.pm.org/archive/200005/codegen/index9.htm

Enhanced by Zemanta

vino – connect to running GNome session like RDP

2011-02-04 2 min read Fedora Linux

One thing that all of us Linux users have probably missed is connecting to the running GNome session to see what is going on in the running session. This can be quite handy in couple of situations:

  1. Debugging remote sessions – where you do not want a new session, instead want to connect to running session.

  2. Maintaining running session from another PC. If you are running some applications on some Linux box and want to gracefully stop it using some commands other than kill -9 then it is best that you connect to the running session, if you are not using screen.

    Continue reading

Photography – Stock photos on bigstock.

2011-02-01 1 min read Photo

Couple of days back, one of my friends suggested that I put my photos on bigstock also along with my site at http://shop.amit-agarwal.co.in . I thought, let me give it a try and created a account on bigstock. After creating the account, I have so far submitted 5 images and four of them got rejected.

The rejections did not de-motivate me, in-fact this has taught me a lot of things. Some things that I did not know before I submitted my photos there. So, I am going through a new learning and this has cost me 80% rejection in bigstock. I am trying with few more photos in next few days and probably I will get a better idea of what is required in the photos. Hope to get the tricks of the trade soon. BTW, another way you can help me keep this blog alive is by buying my photos cheap at bigstock and here is the link to my photo :

Continue reading

Ranking of the most frequently used commands

2011-01-31 2 min read Linux Uncategorized

Lets take a quick look at how to get the most frequently used commands on you shell. So what we need to do is this:

  <td>
    <div class="text codecolorer">
      history | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -n | tail | sort -nr
    </div>
  </td>
</tr>
1

So, how did we arrive at this and will this always work? No it might not always work. A typical example is where HISTTIMEFORMAT variable is set. In that case, if you check history, you will see that after the number column we have time and date in the specified format, in which case, you will get wrong information from the above command. Anyways, forgetting these special cases, lets go to how we got this command:

Continue reading

fork a new process in perl

2011-01-27 1 min read Uncategorized

I was doing something today and found that I require to fork a new process in perl. Now I had never done this earlier, so I did not know how to do this.

First some background :

I was doing some program very similar to http server, where the script accepts some input through a socket and then processes the same. In doing so I was seeing that the script was taking some time in processing the input and thus was not processing the second request until the first one was completed. Simple solution, fork the process.

Continue reading

bash mathematical calculators.

2011-01-25 3 min read Bash Fedora Learning Linux

To start with , the most simple and easy to use should be “bc”. but just for some guys who want to be more experimental, here are few more bash calulator programs. These are completely command line and thus you can completely integrate them in your shell script or use them in shell script to do some really crazy maths calculations.

  <td>
    <div class="text codecolorer">
      sudo yum install calc clac
    </div>
  </td>
</tr>
1

Lets start with installing these. Before we start, don’t blame and flame me if your favourite is not there in the list. If it is not, better is you drop me  a comment or email, and I will see, if I can include it in the list above, but remember this is only for console based calculators.

Continue reading
Older posts Newer posts