top-mode.el can run the Unix program “<tt>top</tt>” from Emacs.
You can find it here: Lisp:top-mode.el
Notice that top runs inside eshell flawlessly.
Nice mode, but lacks many features: face highliting (runnable tasks, own tasks, etc), choosing signal which to kill with, list of files opened by process (like in htop). – IvanKorotkov
Load it with <tt>autoload</tt> or <tt>require</tt>. The enter
or load it permanently with
in your emacs configuration file.
Press <tt>g</tt> to run top and <tt>q</tt> to quit. Other features are:
If you want this to auto-refresh like the shell’s top, you might add the following to your .emacs. It binds the A key in top-mode to an interactive function. Set the refresh rate in seconds, and turn off by setting the refresh rate to 0.
Note that a refresh rate of 1 is not recommended, as the <tt>top</tt> function moves point to top’s buffer. This leaves little time to render the prompt and let the user change the refresh rate in the minibuffer.
It would be nice if <tt>top</tt> updated its buffer without moving point, so you could have top in one buffer and work in another.
(defun top-auto-refresh (rate) (interactive "nTop refresh rate (seconds): ") (progn (cancel-function-timers 'top) (if (not (zerop rate)) (setq *top-refresh-timer* (run-with-timer 2 rate 'top))))) (define-key top-mode-map "A" 'top-auto-refresh)
Anything is a candidate selection framework.
‘M-x anything-top’, narrow the top output by typing some patterns(multiple patterns are space-delimited string), select with up/down/pgup/pgdown/C-p/C-n/C-v/M-v, Enter to kill.
C-z kills selected process without quitting anything session.
Lisp:etop.el provides command M-x etop to display top(1) output.