Some useful linux tips

Tip #1 : Run a command multiple times
repeat is a useful built-in command in csh for this purpose. This comes extremely handy while doing performance benchmarking of programs, where we want to calculate average runtime over multiple runs. e.g:

repeat 3 ./a.out < inp.txt
Total Program runtime: 0.012 seconds.
Total Program runtime: 0.014 seconds.
Total Program runtime: 0.015 seconds.


The repeat command is not built-in bash shell. I have written this script that does something similar to csh repeat.

Tip #2 : Resizing all images in a directory
One may need to supress image quality in order to transfer/upload photos on internet. I have written this script which basically scales all the images in a directory to a smaller size. Note that this script makes use of convert command which comes alongwith ImageMagick installation. e.g:
[guest@user]./image-resize
Usage: ./image-resize input_dir resize_factor(in %)
[guest@user]./image-resize . 30%
Resizing image in directory . to ./resized geometry 30%
Resizing ./DSC00189.JPG ..
Resizing ./DSC00190.JPG ..


Tip #3 : Command line dictionary
I find command line applications faster to use than their gui versions. The sdcv, console version of StarDict program has definetly made looking up word meanings easier for me.

Now I can simply do:
[guest@user] meaningof foo

to fetch meaning of the word 'foo'

[guest@user] pronounce foo

to play an audio saying 'foo'

To make these commands available, one can use this script. This could be directly put in or sourced from bashrc.

Tip #4 : Keep track of your life goals (from command line!)
This minimal script lets you add/discard/say tasks from command line.

Give it a try!