pgbench command not found

In this troubleshooting guide we learn how to fix pgbench command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

pgbench: command not found

or when using sudo you get the following error message

sudo: pgbench: command not found

Solutions to pgbench: command not found

How To Fix pgbench: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu pgbench is provided by postgresql-client-common package.

postgresql-client-common is:

The postgresql-client-common package provides a structure under which multiple versions of PostgreSQL client programs may be installed at the same time. It provides a wrapper which selects the right version for the particular cluster you want to access (with a command line option, an environment variable, /etc/postgresql-common/user_clusters, or ~/.postgresqlrc).

PostgreSQL is a fully featured object-relational database management system. It supports a large part of the SQL standard and is designed to be extensible by users in many aspects. Its features include ACID transactions, foreign keys, views, sequences, subqueries, triggers, outer joins, multiversion concurrency control, and user-defined types and functions.

To fix this problem, we can install more using the command below.

sudo apt-get -y install postgresql-client-common

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install postgresql-client-common.

sudo apt -y install postgresql-client-common

Or if you have aptitude installed you can use the following command.

sudo aptitude install postgresql-client-common

Summary

In this tutorial we learn how to fix pgbench command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.