Open Source Developers @ Google Speaker Series

Open Source Developers @ Google Speaker Series: Ben Collins-Sussman and Brian Fitzpatrick

Open Source Speaker Series: Practical MythTV video on Google Videos :
http://video.google.com/videoplay?docid=-6641045817693171683

Linux Bash Starters

I've been using Linux fo quite sometime now. One of my friends - Viraj Turakhia - who started using Linux lately, came up with a couple of questions on using Bash and customizing it for ease of use. This text is a result of the answers to his questions - for Linux starters this will definitely be a boon and I'm sure there are many of us who have been using the shell for a long time, yet will find these articles a good learning.

First - what the hell is a shell?
A shell is interface to the underlaying complexities of an operating system. Mostly shell is used for a command line / text based UI - however, the term is generic enough. Latest Linux distributions ship with those cool GUIs and make the shell a bit less prominent. Nevertheless, you use the GUI or not, working with the terminal ( or konsole or sh or ksh or csh or bash) is fun sometime or the other.

Second - what is Bash?
Bash - acronym for "Bourne-again shell" is a "shell, or command language interpreter, that will appear in the GNU operating system. Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh)" and is probably the most widely used shell scripting environment. Most of the items here apply for shell scripting on Bash.

Ok, enough of supplements, where is the real stuff?
For all those users who want to get shell-started, I've populated a list of articles and tutorials. These will help you grasp the concepts to use when working on Linux and scripting using Bash. Since the articles will overlap on a few topics, I've included my comments on what to expect from each :
  1. Tutorial: The best tips & tricks for bash, explained by Rechosen - The Linux Tutorial blog features this must for every Linux Starter. This tutorial explains the basic concepts we use in everyday scripting - most importantly stream redirection (stdout, stderr, stdin), foreground and background jobs (fg, bg), and piping.

  2. Linux Shell Scripting Tutorial - A Beginner's handbook by Vivek G. Gite - is a detailed tutorial on shell scripting. It covers the basics of Linux (from getting Linux) to the advanced topics like expressions, IO, awk and more... This link is good for users who have just started using the shell and need help moving around. Finally, there is a whole section for sample shell scripts to check if you got the tutorial right :).

  3. Linux Tutorial by Clarica Grove - Knowledge about the Linux filesystem, its directories, and their usage is very important for effectively working on the shell. This tutorial helps the user get comfortable with the Linux environment. It also explains other important aspects of a shell and their usage. Another important entry in this tutorial is a topic on permissions - I've witnessed many people who get pissed of working on the shell, just because they have they have not done their homework on this topic!

  4. BASH Programming - Introduction HOW-TO by Mike G - One of my favorite sites for Bash - its clean and simple. However, as the site says "It does not intend to be an advanced document (see the title). I am NOT an expert nor guru shell programmer. I decided to write this because I'll learn a lot and it might be useful to other people" this tutorial is for basics.

  5. Power Shell Usage by Simon Myers - One of my favorites when it comes to shell customization and power usage. Arm yourself with these simple tricks and you'll love using the ease of using the shell! This page is actually a presentation by Simon and includes notes for explanation. A PDF version of the same is here.My Favorite bash Tips and Tricks by Prentice Bisbal - is a good deal for users looking for those nifty magic shell tricks!

  6. Red Hat Knowledge Base explains shortcuts and inputrc basics - This article from the Red Hat Knowledgebase briefs about using keyboard shortcuts and customizing the inputrc file.
I suppose these links should be a very good start into shell programming - so, that's ll folks! There are many other advanced tutorials on shell scripting - IO, regex, looping, piping and more..., but these links will arm you with the basics of shell scripting - using which the advanced topics will seem pretty simple.

While running behind your links for a perfect shell tutorial, if you find something even better than those listed here, please do share it with me.

Happy scripting. Books are the best companion to get learn anything. Following are my recommendations :



High Resolution Timer

While working for at Persistent Systems Pvt. Ltd., Pune, we developed a small library with Java and C++ wrappers to implement very high resolution timers. We use these timers to count the ticks when doing performance analysis and stuff like that. I would like to thank Nikhil Deshpande and Chandraprakash Jain, my seniors at work, in helping me out while I was working on this tool. Infact, the java wrapper for this library is a contribution from Nikhil.

The library I developed exploited the system dependent timers / clocks and provided a timer like interface to the same. The library, compiles and functions on Linux, Solaris and Windows. The attached file, has build scripts for Linux and Solaris. There is also a Java wrapper over the library, which uses JNI to use the timer interfaces.

My observation is that while Linux system timers allow a resolution to count till microseconds, a Solaris box can provide resolution to nanosecond levels.

The code is pretty dirty when it comes to system specific decisions, but provides a clean interface - complete with error message details, error handling, easy to use functions, extensible and customizable design.

The ReadMe.txt file, explains some of the stuff that I've done. Click here to read the file, without having to download the entire code. The library is LGPL licensed - you are free to use, redistribute and modify the same to suit your requirement, as long as you confirm the license agreement.

Click on the links below to download the source code for the high resolution timer library :

freshclam: "Problem with internal logger"

I had a happily running server with clam-av-0.88 (Clam Antivirus version 0.88). Suddenly, I started getting cron messages, regarding "freshclam-sleep" spitting out an error message "ERROR: problem with internal logger".

After a bit of searching, our first hit was that there was a permission issue. However, that was not the case for me.

The solution finally was that I had to restart the freshclam daemon. From the commmand :

ps aux | grep clam


I realised that there was a stray freshclam-sleep process runing. The oputput looked like this :


qscand 2056 0.0 0.9 81384 38820 ? Ss 2006 20:13 /usr/sbin/clamd
qscand 2064 0.0 0.0 2548 1072 ? Ss 2006 0:01 /usr/bin/freshclam -d -p /var/run/clamav/freshclam.pid
root 1454 0.0 0.0 2260 936 ? Ss Mar28 0:00 /bin/bash /usr/share/clamav/freshclam-sleep
qscand 12425 0.0 0.0 2544 1004 ? S Mar28 0:00 /usr/bin/freshclam --quiet
root 17913 0.0 0.0 3860 668 pts/0 S+ 05:30 0:00 grep clam



I just killed all the freshclam processes, deleted the lock file for freshclam and started the daemon with


/sbin/service freshclam start


and voila everything started working like a champ!!!

That was pretty much it....
Hope that helps.

Madhur Tanwani himself!!!

Friends, here is something that you can always use to find out anything
about myself. This blog will help people know more about me - Madhur
Kumar Tanwani. I'll try keeping it as updated as possible.

Name : Madhur Kumar Tanwani

Contact Email : madh...@gmail.com

Date of Birth : 15th June

Contact Details :


Home Address :
"GODHAN",
Saubhagya Nagar,
Lam Road,
Nashik Road,
Nashik - 422101,
Maharashtra,
India.
Current Address :
Madhur Kumar Tanwani,
"AALAYAM", Site 25 & 26,
Door No 8, 2nd Cross,
Near Suhag Residency,
Seenappa Layout,
Sudda Gunta Palya,
C.V. RamanNagar,
Bangalore-560093,
Karnataka, India.
Mobile : +91-9739973184

Office Address :

Microsoft India (R&D) Pvt Ltd.,
Global Technical Support Center,
Signature building,
Embassy Golf links Business Park,
Off Intermediate Ring Road,
Domlur,
Bangalore - 560071.

More Details About Me : 
 
Stats