Sunday, May 10, 2009

bash : search and replace from previous command

tar -cvf sandeep.tar sandeep/

!!:gs/sandeep/singhal will mean

tar -cvf singhal.tar singhal/

:gs is for global search and replace

bash - last argument of the previous command (nth argument)

  • Get the last argument of the previous command : !!$
  • Get the first argumnet of the previous command : !!^
  • Get the 1st argument of the previous command : !!1
  • Get the nth argument of the previous command : !!n

Examples : 

$> ls :!!$  (or !$) 

$> ls :!!^

$> ls :!!2

$> ls :!!n

Saturday, May 2, 2009

Trigger GC in eclipse.

This is a handy for eclipse which lets you to trigger gc in the eclipse instead of waiting for the jvm to schedule the GC .

Go to Window->Preferences->General, mark Show Heap status check box.
The current Heap usage with icon for "Run Garbage Collector" will appear at the bottom right.

It helps a lot in eclipse performance.

I find it pretty handy especially because I do not shutdown eclipse often.

Friday, May 1, 2009

Two things I love about opera

1. You can type windows specific path on the browser bar and it will covert it to "forward slashes" when you are browsing directory like strucure on a browser

2. The quick search box : The cursor remains at the same place if you go to a different window by "ALT-TAB". This in firefox changes to select the entire text already typed in the search box. Hence you cannot start typing straight away, since that will erase the already entered text.