Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-21-2009, 11:59 PM   #1
LQ Newbie
Registered: Sep 2009
Posts: 3

Rep: Reputation: 0
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.


Last edited by energyAlchemist; 09-22-2009 at 12:03 AM.
Old 09-22-2009, 03:39 AM   #2
Registered: Jun 2008
Location: Belgium
Distribution: Debian
Posts: 109

Rep: Reputation: 42

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 :
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.
Old 09-22-2009, 04:07 AM   #3
LQ Newbie
Registered: Sep 2009
Posts: 3

Original Poster
Rep: Reputation: 0

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.

Old 09-22-2009, 09:39 PM   #4
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
See Tcl/Tk; typically interfaced with Perl.


bash, scripts

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
error while try to install htop-0.8 Elnegro8 Linux - Software 5 08-26-2013 03:36 PM
LXer: Htop, a tip-top ncurses interactive tool for system monitoring your desktop LXer Syndicated Linux News 0 03-26-2009 03:21 PM
Need Help reagarding Kernel Debugger linux_mani Linux - Newbie 0 12-12-2008 06:35 AM
Reagarding Vi editor linuxjamil Linux - Server 3 08-03-2007 10:14 AM
kde app always on top mikegorb Linux - Software 2 07-17-2005 02:37 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:31 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration