Pem: Manage Your Personal Expenses from the Command Line

While expense management is a critical task, both for businesses and individuals, it generally requires you to use a GUI-based software. If you’re a command line geek who is looking for a CLI-based alternative, you should give pem a try. In this article, we will discuss the command line tool, along with the features it provides.

Note: all the examples discussed in this article are tested on Ubuntu 14.04.

Pem Installation

The easiest way (that I found) to install the tool is by downloading the package from its official website, building it from source, and then installing it. Here are the steps:

tar -xzvf pem-0.7.9.tar.gz
cd pem-0.7.9
sudo make install

An important point worth mentioning here is that instead of using wget (the first step), you can head to the GNU website to download the latest version of the tool.


Basic usage of the pem command is very easy – you just have to pass an expense note or description, followed by the expense amount. Here is an example:

pem "Weekend Lunch" 700


The command above stores the description “Weekend Lunch” as well as the amount 700 in a file, which is named after the current month, and placed in the “.pem” folder under your HOME directory.

Note: if the expense description consists only of a single word, it is not mandatory to put it in double quotes, but if there are multiple words, it should always be put in double quotes.

Here is what the file contains:


The format of the output is [code],[tag],[income],[expense]

Use customized file name using -f option

Instead of using the standard file name and location (as specified in the previous example), you can also specify some other file using the -f option. Here is an example:

pem -f ~/Desktop/exp.txt "Birthday" 1000


The command above will store the expense amount as well as details in the exp.txt file located on the Desktop.

Record an earning using the -e option

Like any other expense manager, the pem tool also lets you record your earnings, which can be done using the -e option. Here is an example:

pem -e "Salary" 4000


Categorise your expenses or earnings using the -c option

You can attach tags or categories to your expenses or earnings using the -c option. For example:

pem -c 'travel fun' "Trip to Vegas" 4500


The command shown in the screenshot above lists “Trip to Vegas” under the ‘travel fun’ category.

See a daily report using -s option

You can ask the pem command to display a daily report using the -s option. Here is an example:

pem -s


You can also pass a number along with the above command to see a daily report with total after that many days. For example, pem -s 3 would display a daily report with a total after 3 days.

Similarly, you can use the -m option to display a monthly report.

Display category/tag-wise report using -C option

Sometimes it is required to view results based on a particular category or tag. You can do just that using the pem command’s -C option. Here is an example:

pem -C travel


So you can see that the command shown in the screenshot above displays results related to the ‘travel’ category.

For more options, go through the man page.


The pem command may not offer advanced functionality, but it does provide features that a basic expense manager should. The real power of the tool, however, lies in the fact that it makes managing expenses from the command line very easy.

Have you ever used pem or any other command line-based expense manager? Share your experience in the comments below.

Himanshu Arora
Himanshu Arora

Himanshu Arora is a freelance technical writer by profession but a software programmer and Linux researcher at heart. He covers software tutorials, reviews, tips/tricks, and more. Some of his articles have been featured on IBM developerworks, ComputerWorld, and in Linux Journal.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox