LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-16-2010, 01:43 PM   #1
chamila1986
Member
 
Registered: Oct 2009
Posts: 31

Rep: Reputation: 15
Question htop execute and exit...


I found 'htop' is better than 'top' and Is there a way to execute 'htop' command once and exit...i.e. stop refreshing window and continue console without pressing 'q' or 'ctrl+c'...(like 'top -n 1' in 'top')
 
Old 01-16-2010, 03:16 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Something to consider is that HTOP doesn't leave any text on the console like TOP does. Does this matter?

Here's a kinda hacky way of doing it, but there may be a better way (htop doesn't seem to like being run any other way than just "run" plain and simple..)

This will run htop for 5 seconds. Change the 5 to less if that's too long:

Code:
#!/bin/sh

{ sleep 5; killall htop; exit; } &

htop
Sasha
 
Old 01-16-2010, 03:21 PM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Nope. htop is not meant to work in batch mode. Actually this is on the "Feature requests" list, but as far as I know, there is no way to run htop non-interactively or to prevent it from clearing the list of processes when it returns to the command prompt.
 
  


Reply


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
top-execute and exit chamila1986 Linux - Newbie 3 01-07-2010 01:47 AM
Help? how to execute the /etc/profile without having the user exit then logon? icecoolcorey Programming 3 06-12-2008 09:48 AM
Assembly, "bash: ./exit: cannot execute binary file" User Name. Programming 4 08-07-2007 09:09 AM
In perl is there a way when i call exit function to execute a subroutine alix123 Programming 3 06-01-2007 05:38 AM
SSH: execute one command then exit kleptophobiac Linux - Software 10 01-30-2004 08:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:21 AM.

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