CLI Magic: Lightweight Conky is a system monitor powerhouse

601

Author: Shashank Sharma

Conky is a lightweight system monitor that provides essential information in an easy-to-understand, highly customizable interface. The software is a fork of TORSMO, which is no longer maintained. Conky monitors your CPU usage, running processes, memory, and swap usage, and other system information, and displays the information as text or as a graph.

Debian and Fedora users can use apt-get and yum respectively to install Conky. A source tarball is also available.

Before you start the program, you need to have a .conkyrc file, which contains all the settings that control the behaviour and appearance of Conky. Extract conkyrc.sample from /usr/share/doc/conky to your home directory and rename it .conkyrc with a command like gunzip -c /usr/share/doc/conky/example/conkyrc.sample.gz > ~/.conkyrc.

To run Conky, type conky in a console and press Enter. Don’t panic if you don’t see anything — Conky sets up its display in the root window. If you minimize all open windows, you’ll find Conky sitting pretty on your desktop.

When run without any options, Conky draws itself on the lower left corner of the desktop. You can specify a position with the -a {top/bottom}_{right/left} switch; that is, to place Conky in the top-right corner, run conky -a top_right. You can additionally use -x and -y switches to specify X and Y coordinates on the screen along with -a option.

Several settings determine Conky’s appearance. You can decide if you want Conky to have a border, a background color, a transparent window, and even what it displays. By default, Conky displays many things that you might not need. You can change what Conky displays by modifying the .conkyrc file.

The .conkyrc file has a simple format. The variables that determine Conky’s behaviour are described first. The second part of the file begins with the line TEXT. Here you’ll find a list of various items that Conky displays, such as CPU temperature, network traffic, and memory usage. To remove any item that Conky displays by default, you need to edit here. I removed these lines from my .conkyrc file because I didn’t need a network traffic indicator:


${color lightgrey}Networking:
Down:${color #8844ee} ${downspeed eth0} k/s${color lightgrey} ${offset 80}Up:${color #22ccff} ${upspeed eth0} k/s
${color #0000ff}${downspeedgraph eth0 32,150 ff0000 0000ff} ${color #22ccff}${upspeedgraph eth0 32,150 0000ff ff0000}

Before you make any changes to the file, save a backup with a command like cp .conkyrc .conkyrc_orig.

In addition to monitoring system information, you can use scripts with Conky to display non-system-specific information on your desktop, such as the weather in your area or the scores of a game. Many such scripts are listed along with a screenshot and respective .conkyrc file on the project’s screenshots page. To make Conky run your script, you need to again edit the .conkyrc file, include the script with the $execi variable, and specify a periodic time interval that Conky should wait before executing the script again. You can read about $execi and other Conky variables on the project’s descriptions page.

If you have a script to display live scores of a soccer match, you could include code like this at the end of the .conkyrc file:

${color magenta} Match score:
${color blue} ${execi time /location/to/script/score_script.sh}

Then, after every time seconds, Conky would execute the script, thus providing you with periodic reports.

Conclusion

Conky’s ability to run custom scripts is one of its strengths, but running scripts requires resources, and you’ll find these scripts can eat up most of your memory.

I have been using Conky for some time now and haven’t found it to be missing any important features. But if you do, there’s an active forum board and feature request table that might interest you.

Shashank Sharma is studying for a degree in computer science. He specializes in writing about free and open source software for new users.