manu

Borg bash wrapper

Borg backup is an efficient and secure way to backup data. It is space efficient, fast, uses compression and deduplication as well as authentication and encryption.

I use my own simple wrapper with a single repo.

borg list

The bl command lists all archives of the repository and is able to filter them with an argument (optional). It also sorts the list of archives by name instead of date.

borg backup

The bb command creates a new archive with the target folder and current timestamp as unique name. It also takes care of any database with the same name and dumps it into an sql file1. It also excludes all the dependencies one could think of such as node_modules, composer’s vendor directory or the virtual environments Python uses.

borg delete

The bd command deletes not only one, but all the archives of the respository of a given name. Use an empty set of quotes to delete them all.

borg restore

The br command extracts the first archive found by a given name to the global temporary folder with the unique archive name created as folder and cd’s into it then.


  1. This one is an easy convention I prefer to stick to.