How to manage your personal expenses from the command line

Last updated on August 30, 2020 by Adrien Brochard

The Linux command line can be used for many things, like making spreadsheets, playing music, or accessing Facebook or Twitter. And to pursue our dream of ultimate graphic-less knowledge, I propose you today with a tool to manage your personal expenses from the command line. The name is GNU Pem, for "Personal Expense Manager".

Installation of GNU Pem

For Debian or Ubuntu:

I could not find a PPA for recent versions of Ubuntu, so the simplest way is still to download the package from the official source, extract it, and then run the traditional:

$ ./configure
$ make
$ sudo make install

For Arch Linux:

For Arch Linux users, you can check out the AUR.

For Fedora or CentOS/RHEL:

$ sudo yum install pem

For CentOS/RHEL, you need to enable EPEL repository first.

Usage of GNU Pem

Pem uses your system clock to record your transactions. So before using it, make sure that the time on your computer is correct.

Pem is very easy to understand. The basic usage to record an expense is:

$ pem [tag] [amount]

where [tag] is anything that will remind you of your expense.

So for example:

$ pem candy 10

will remind me that I spent $10 in candy today. If I want to use spaces in my tag, I like to use quotation marks:

$ pem "magic cards" 40

To record an income, use the flag -e:

$ pem -e babysitting 50

Finally, to see your expenses for the last n days, use the command:

$ pem -s [n]

Notice that if you leave n blank, it will show you all your expenses for the day nicely formatted.

It is possible to have a monthly report with a similar structure:

$ pem -m [n]

But a really helpful feature is the ability to set categories. Using the flag -c you can specify a category for your expense.

$ pem -c [name] [tag] [expense]

An example would be:

$ pem -c games Pac-Man 2

for spending $2 buying a Pac-Man game.

And you can see all the categories with:

$ pem -C

Behind the scenes, Pem will create by default a .pem folder in your home directory in which it will store your transaction using the directory structure:

.pem/[last two digit of year]/[Month]

A transaction will be recorded in the month file using the format:


If you wish to write your expenses to a specific file, you can use the -f flag:

$ pem -f myexpenses.txt candy 10

The details are not that interesting, unless you want to export the data later. The programmers suggest using a spreadsheet software to do so.

To conclude, I really enjoy using Pem. It is a nice little piece of sotfware that does one job and does it well. It is possible to imagine combining it with some sort of script to automate the whole process. I could probably use it to record all the money I spent buying Steam games on sale. I encourage you to visit the official page, and read the manual entry to learn more about it.

What do you think of Pem? Would you consider using it or is it too nerdy? Let us know in the comments.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean