LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Looking for direction with reagarding a top/htop like app (https://www.linuxquestions.org/questions/programming-9/looking-for-direction-with-reagarding-a-top-htop-like-app-756906/)

energyAlchemist 09-21-2009 10:59 PM

Looking for direction with reagarding a top/htop like app
 
Hey All,

I write alot of generalized scripts for watching processes, cpu/mem usage etc...

I am looking at writing an app that posts new data to the screen, similar to top or htop. Mainly i am after how you get the "static" looking screen and just update that as needed.

Not looking for code, but if anyone can point me in the right direction on google, i would greatly appreciate it.

If my question is too vague, please let me know.

Thanks,
~

antegallya 09-22-2009 02:39 AM

Hello,

Usually people use "curses" for that.
You can watch the source code of some applications that use it to get detailed examples.
Usually its used in C programs but there are bindings to other languages (I know iotop uses it in python for example).

But you can do it 'as well' in a shell script although it might be somewhat slow, but if it's only for a little script of your own, why not. In that case, tput can help you. An small example :
Code:

tput clear
tput cup 10 10
echo "Hello"
tput cup 11 16
echo "World"

you can read the man page to get some extra information.

Hope this helps.

energyAlchemist 09-22-2009 03:07 AM

Hey,

Thanks for the info, I am open to other languages for this app, kinda started with shell at random.
I will check into tput as well some python or c and see what i can dig up.

Thanks much. :)

~

chrism01 09-22-2009 08:39 PM

See Tcl/Tk http://en.wikipedia.org/wiki/Tcl; typically interfaced with Perl.


All times are GMT -5. The time now is 06:13 PM.