Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Calculate Invoice Amounts with Bash as a Freelance Developer


Keeping track of your billable hours is a tedious task as a freelance or contract worker. How's how you can automate it with Bash.

Quick Jump: Demo Video Showing How It Works

I used to spend about 15 minutes a month calculating invoice amounts for all of my clients because it involved manually adding up a bunch of hours I wrote down in a log file.

For the last few months I’ve been using an invoice script that I recently released on GitHub. You can run a single command to get your invoice amounts in a few seconds for any number of clients you might have.

All it involves doing on your end is to create a simple log file which I’m sure you’ve been doing in some way or another to keep track of the work you’ve done and how many hours you’ve put in.

The documentation in the git repo has all of the details on how to format the log file and use the invoice script but I also put together a video showing exactly how to use it.

Also, the script has a bunch of tests and I double checked it against 50+ real invoice amounts from last year. In every case it matched up to the exact cent. You can never be too safe when it comes to things that involve money!

Demo Video Showing How It Works

Timestamped Table of Contents

  • 0:24 – How I used to manually calculate invoice hours for all of my clients
  • 3:54 – Highlevel overview of the Markdown based log file
  • 4:55 – Running the invoice script to get the total amount, hours worked & days worked
  • 6:07 – Customizing your hourly rate from the command line or in the log file
  • 6:58 – Dealing with multiple years or months worth of data in your log file
  • 7:54 – Using the invoice script to get invoice amounts for specific years or months
  • 8:41 – Enabling DEBUG mode to get a full break down of how the totals were calculated
  • 9:17 – Calculating invoice amounts for all of your contracts at once
  • 10:28 – Creating the invoice in a few seconds using a Google doc template (for now)
  • 11:35 – Checking out the invoice script on GitHub
  • 12:27 – Best practices based on 20 years of doing freelance contract work
  • 14:25 – Quickly going over the test suite for the invoice script
  • 15:29 – Quickly going over the invoice script and its help menu
  • 17:20 – Contribute by reporting bugs or by opening pull requests

What features would you like to see added to the script? Let me know below.

Never Miss a Tip, Trick or Tutorial

Like you, I'm super protective of my inbox, so don't worry about getting spammed. You can expect a few emails per month (at most), and you can 1-click unsubscribe at any time. See what else you'll get too.