mtree command not found

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

Introduction

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

mtree: command not found

or when using sudo you get the following error message

sudo: mtree: command not found

Solutions to mtree: command not found

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

In Ubuntu mtree is provided by mtree-netbsd package.

mtree-netbsd is:

The mtree utility compares a file hierarchy against a specification, creates a specification for a file hierarchy, or modifies a specification. This specification can be controlled by the user, but typically includes file/directory/symlink names, ownership information, permission bits, and so forth. It may optionally also include various hashes, such as SHA-256 or MD5.

This mtree utility can understand its own files, as well as those generated by the FreeBSD mtree (in Debian as fmtree in freebsd-buildutils and freebsd-glue) and bsdtar/libarchive.

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

sudo apt-get -y install mtree-netbsd

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

You can also use apt command to install mtree-netbsd.

sudo apt -y install mtree-netbsd

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

sudo aptitude install mtree-netbsd

Summary

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