Nov 19

IMG : Quick TipLately I have been looking at improving my command line skills in Linux, and here is a quick tip to truncate a file to zero byte file, helpful to empty huge log files quickly.

:>filename

or you can also use the common method which make more sense:

cat /dev/null > filename

So enjoy and let me know any command line tricks if you know.

Apr 12

Ever since I started using DeVeDe I quite missed a feature of Nero DVD creation software – ‘Shutdown when complete’ as I usually keep for convertion from XVid/DivX to DVD during the night.

The process usually takes 4 hours, hence it would waste of electricity to keep the computer on for another 3 hours. So I searched for various options to shutdown the computer after predetermined time, the most popular one being use of cron.

But I did not want to set up ‘cron’, so I went on to find an alternative, which is when I found the ’shutdown’ command itself.

On Ubunutu machine, all I had to do was issue the following command in terminal:
sudo /sbin/shutdown -h +300

Command Details:
sudo : This is to execute the command as root, you will need the password here.
/sbin/shutdown : Command to shutdown the computer.
-h : This tell the shutdown command to power off i.e. halt.
+300 : The minutes before scheduled shutdown, here it is 300 minutes.

Make use of the command and let me know if you have some easier or more simpler alternative.

Apr 23

CameraPhotos….Photos…and more Photos…..ever since I bought the digital camera I have been clicking photos of anything imaginable. I have been on a few trips as well, hence I thought of putting some of the good ones on the web and share it with a few friends, and the best solution for these for me turned out to be Picasa.

So off I went about putting together the photos I wanted to upload to Picasa Web, that is when I realised that I am in a bit of trouble. With each photo being 1.8MB, it was very obvious that I needed to resize the photo’s to a more web appropriate resolution of 1024×768 and at a lower image quality.

I did not directly recollect any software available in Linux which has batch resize options, hence I quickly did a google search and the results surprised me. The solution was a really simple one, that of making use of the package which is by default available in most Linux distro’s – “ImageMagick”, which provides the ‘convert’ command.

Here’s the simple script:
for k in $(ls *.JPG); do convert $k -resize 1024×768 -quality 100 re_$k; done

The working of the above script is simple, here is what it does:
1. Loops through all the JPG files in the current directory.
2. Then for each JPG file in the directory it calls the ‘convert’ command telling it to resize the images to the size 1024×768 and without an quality loss (i.e. 100, means no compression) and saves the resultant file with the prefix ‘re_’.
3. The done statement tells the script to end once all the JPG files are processed.

How is that for a simple and effective solution. Three cheers for command line….who needs bulky and resource hungry GUI programs…? And if you are waiting for the photos…sorry…that is available only to a few select friends and relatives…..but I have posted some of them at the following link http://flickr.com/photos/knithink.