/ tuesdaytooling

Tuesday Tooling: Glances

They exchanged glances across the busy room. Amid the chaos of social distancing they knew that they were meant to be together, and that is when Les reached over and picked up the last pack of toilet roll in the store.

So is this a love story?

No, sorry!

So what is this all about?

Glances is a cross platform, Python powered system monitoring tool that packs lots of data into a small package.

This blog post was inspired by Brian "Linuxing in London" Byrne who mentioned Glances in a tweet last week. Thanks Brian!


Hi reader!

I never put my blog posts behind paywall or pop ups because quite frankly that is annoying and prevents anyone from accessing the content. I will always keep my blog content free of charge. But I do ask that if you are able and willing, that you buy me a "coffee" as it helps me to pay for hosting this blog, and to buy stuff to hack from Poundshops / Dollar Stores / Aliexpress which are used in free projects and reviews on this blog. It is You dear reader who make this possible, and I am immensely grateful for your support.

So this is just another system monitoring tool?

It might look like it, but no this can do a lot more. Lets install and take a good look around.

So how do I install glances?

Glances is written in Python so we need to use PyPi.
Linux / macOS

sudo pip3 install glances


pip.exe install glances

Windows users will also need to install the ncurses user interface package.

pip.exe install windows-ncurses

Ok I've installed it, now what?

From a terminal / command prompt type glances to see a quick overview of the system.

Getting quick data from Glances

Just need to see a few quick pieces of information? No problem!
Here I am asking Glances to print a timestamp, how much of the CPU is being used by my user, how much RAM has been used, and what the current loads on the system are. This is all output in a JSON format.

glances --stdout now,cpu.user,mem.used,load

Saving to a JSON file

This is great but what if we want to save a JSON file? Use this command to create a JSON file called test.json which we can explore later.

glances --stdout now,cpu.user,mem.used,load --export json --export-json-file test.json

And here is the JSON file!

Saving to a CSV file

Need the data in a CSV format? I got ya! Just add -csv to the previous command.

glances --stdout-csv now,cpu.user,mem.used,load

But what if we want a CSV file to be generated? Well use this command to create a file called test.csv which can be opened in a spreadsheet application.

glances --stdout now,cpu.user,mem.used,load --export csv --export-csv-file test.csv

And this is the output, opened in LibreOffice Calc

Sharing the data over a network

NO! Glances can also be used with a web browser! To do this, start glances with the -w switch, like this.

glances -w

Then open a browser on the same machine to your loopback IP address, and port number 61208, like this.

That's cool, but I want to see this data on another device?

Sure! The Glances web interface can be accessed from another device. Here I am looking at my system status from my Android phone. I replace the IP with the IP address of my computer, in this case

Further reading

There are many more examples over in the Glances documentation, and a little reading on this site will save the sys admin a little more time in their day.

Happy Hacking