I've searched a lot but I can't find a way to show nethogs in conky. nethogs prints to terminal and there seems to be no way to capture output in real time. This is one thing I have been wanting for conky FOR AGES.


I don't think so.

nethogs is an interactive process using the ncurses library. It expects to launch in a terminal window and get input from the user.

Conky can run programs using the exec/execi/execp/execpi directives, but these are supposed to be "run once" programs which output text then exit. Conky takes that text and displays it.

Try writing to the nethogs developer and see if he'll add "batched" mode, like the batched mode of the top command. If you could get nethogs to run for a second then display its text and exit, you could use that text output in Conky.

| improve this answer | |

I've tried to do the same with conky on Ubuntu 12.10. But then i had a better idea:

  • create a new profile for gnome-terminal (transparent, small font size, whatever you like)
  • install package devilspie (you can also try the GTK version gdevilspie
  • create a new config file for devilspie which will help to get rid of the window frame border and menu

e.g. /home/<user>/.devilspie/gnome-terminal.ds


(if (is (window_role) "borderless")
    (geometry "-0-0")

(geometry "-0-0") will place the window at the bottom right

When the configuration file gnome-terminal.ds has not been written/changed you have to create it and stop/restart the devilspie deamon to see any changes. Dont forget to add the daemon to your startup scripts (XFCE: Setting > Session and Startup).

Now we need a startup bash script which you can add to your autostart just like devilspie. Something like this:


if [ $# -lt 1 ]
  echo "Usage: `basename $0` <iface>"
  exit 1

killall -9 nethogs 2>/dev/null
sleep 5
`sudo -H -u <username> gnome-terminal -e "/usr/bin/nethogs -d 4 $1" --profile=<profile-name> --role=borderless`

exit 0

You must pass an argument to the script to specify the target device. Notice that there is a sleep command within the script, just to make sure that previous nethogs processes are not running.

| improve this answer | |
  • Nicely done. btw conky seems to have an out_to_ncurses option but I haven't played with it. – koogee Feb 15 '14 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.