I am developing some kind of mysql monitoring tool, so I need interactive output like the top command.
Is there any lib that can be used for this?
You can get a good post from ncurses http://www.gnu.org/software/ncurses/
ncurses
Here is the link to the source code of IO-Top. This is software that behaves like top, but displays information related to the IO, not the processor.
top
ncursesalready mentioned. Another approach is bashusing dialog. See http://linux.die.net/man/1/dialog
bash
dialog