Calmcode - cool cli: htop

htop

1 2 3 4 5 6

Installation

You can find more info about the htop project on their documentation page.

If you're on a mac you can install the tool via;

brew install htop

On many linux distributions you should be able to install it via;

apt-get install htop

Usage

The demo.py file in this video has the following contents.

import sys
import random

if __name__ == "__main__":
    _ = [random.random() for i in range(500_000)]
    print(f"these are the input settings: {sys.argv}")

This file can be run with 12 parallel works or 4.

seq 200 | parallel -j 4 python demo.py
seq 200 | parallel -j 12 python demo.py

To see the effect this has on your machines resources you can run htop.

htop

Note that if you'd like to see more frequent updates, you can run this command instead:

htop --delay 2

Running htop with a lower delay parameter will cause it to also use more resources, but you should see more frequent updates.