wg command not found

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

Introduction

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

wg: command not found

or when using sudo you get the following error message

sudo: wg: command not found

Solutions to wg: command not found

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

In Ubuntu wg is provided by wireguard-tools package.

wireguard-tools is:

WireGuard is a novel VPN that runs inside the Linux Kernel and uses state-of-the-art cryptography (the “Noise” protocol). It aims to be faster, simpler, leaner, and more useful than IPSec, while avoiding the massive headache. It intends to be considerably more performant than OpenVPN. WireGuard is designed as a general purpose VPN for running on embedded interfaces and super computers alike, fit for many different circumstances. It runs over UDP.

This package contains command-line tools to interact with the WireGuard kernel module. Currently, it provides only a single tool:

wg: set and retrieve configuration of WireGuard interfaces

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

sudo apt-get -y install wireguard-tools

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

You can also use apt command to install wireguard-tools.

sudo apt -y install wireguard-tools

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

sudo aptitude install wireguard-tools

Summary

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