How to manage your personal expenses from the command line

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

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

Arch Linux

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

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.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.

Adrien Brochard

I am a Linux aficionado from France. After trying multiple distributions, I finally settled for Archlinux. But I am always trying to improve my system by stacking up tips and tricks.

Latest posts by Adrien Brochard (see all)

3 thoughts on “How to manage your personal expenses from the command line

    • This hack works - for example - delete any entry from Nov 2014:

      $ vi ~/.pem/14/Nov
      and then delete any entry you do not want

Leave a comment

Your email address will not be published. Required fields are marked *