Saturday, December 19, 2009

Word web like dictionary in linux - StarDict

In Linux, two best dictionary tools are JaLingo and StartDict. Stardict is supported by many Linux distributions and particularly by Ubuntu.

StarDict uses its own dictionary format. So, you have to install dictionaries before you actually start using StarDict. You can find a good selection of ready-to-use dictionaries at http://stardict.sourceforge.net/Dictionaries.php.

Steps to install it.

$ sudo apt-get install stardict

Download the Dictionary of your choice from http://stardict.sourceforge.net/Dictionaries.php

untar the dictionary file in current directory,

$ tar -xjvf stardict-freedict-eng-hin-2.4.2.tar.bz2

Move the untar file to /usr/share/stardict/dic. Issue this command in Terminal - "sudo mv stardict-freedict-eng-hin-2.4.2 /usr/share/stardict/dic".

Start StarDict, if required kill the process and start it.


Sunday, December 13, 2009

Why does cron fail to run a job? what is cron EOF error?

The cronjobcommand works from the command prompt but from a crontab it doesnt seem to be getting invoked at all.

First, check the error log for the cronjob

$* * * * * cronjobcommand 2> log

One of the problems could be cron EOF error.

esp if the cron command has % in the command (most of the cron commands have `date +%F` to log the output according to date)

Read the manpage for the crontab file (`man 5 crontab`) and pay
particular attention to the discussion of the "%" character. % needs to be escaped

wrong: $ 1 0 * * * /scripts/nmon.sh -F /scripts/log/NMON`date '+%d'`.nmon -t -s 300 -c 2880

correct: $ 1 0 * * * /scripts/nmon.sh -F /scripts/log/NMON`date '+\%d'`.nmon -t -s 300 -c 2880

How to install / untar / unzip a tar.gz tar.bz2 tar zip file in Linux/Ubuntu?

You could try use

tar -xzvf file.tar.gz

tar -xjvf file.tar.bz2

tar -xvf file.tar

unzip file.zip

this will actually uncompress the file.

Depending on package you need to do
./configure
make
make install (Eg. mplayer)

or leave as it is. (Eg. eclipse, tomcat)

How to use 'SCREEN' command in linux?

To start a screen session:

$screen -S screenname

We have now started a screen session with name `screenname`. Lets start a process here for us to understand the working of screen. 'top' command initiates a process that shows the list of processes running on the machine.

$top

Now you find top process running on the terminal.

To suspend screen session do the following.
Press Ctrl + a , z (Press Ctrl + a and then press z)
This would only suspend and does not end the session, so that you can comeback later and check.

Now you are out of screen and at the terminal where you started.

To see the list of screen sessions,
$screen -ls

you should be finding the screenname listed.

To go back to the screen
$screen -dR screenname

you should now find the top command still being executed.

To end the screen
$exit

You can recheck it with `screen -ls` command.

Done !! Now that you have got your hands dirty, you can visit the following resources to know more about it.
http://linux.die.net/man/1/screen