edit command not found

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

Introduction

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

edit: command not found

or when using sudo you get the following error message

sudo: edit: command not found

Solutions to edit: command not found

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

In Ubuntu edit is provided by mailcap package.

mailcap is:

The mailcap system associates media types with programs that can handle them, using system and user configuration files. A file’s media type is determined by its extension or by running the “file” command if available.

Other packages register their programs as viewers/editors/composers/etc by placing mailcap entry files or FreeDesktop menu entries in predetermined directories monitored by this package’s dpkg triggers.

This package provides a “run-mailcap” program to open arbitrary files, and in addition the “see”, “edit”, “compose”, and “print” aliases to display, alter, create, and print (respectively).

This package also provides the “debian-view” utility to handle Debian packages interactively.

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

sudo apt-get -y install mailcap

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

You can also use apt command to install mailcap.

sudo apt -y install mailcap

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

sudo aptitude install mailcap

Summary

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