How To Install bsd-mailx on Ubuntu 20.04

In this tutorial we learn how to install bsd-mailx on Ubuntu 20.04. bsd-mailx is simple mail user agent

Introduction

In this tutorial we learn how to install bsd-mailx on Ubuntu 20.04.

What is bsd-mailx

bsd-mailx is:

bsd-mailx is the traditional simple command-line-mode mail user agent. Even if you don’t use it, it may be required by other programs.

The /usr/bin/mail command provided by this package is a very simple one, and does not include many features that can be found in more advanced mail user agents.

For example bsd-mailx DOES NOT support:

  • MIME (i.e. no attachments, no UTF-8 or other charsets support);
  • SMTP protocol (/usr/sbin/sendmail interface only is used);
  • POP3/IMAP (bsd-mailx reads local mailboxes only);
  • maildir format (traditional mbox only format is supported).

If the above features are needed, please consider installing another package providing similar /usr/bin/mail interface:

  • s-nail package,
  • or mailutils package. Task: mail-server

There are three methods to install bsd-mailx on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install bsd-mailx Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install bsd-mailx using apt-get by running the following command:

sudo apt-get -y install bsd-mailx

Install bsd-mailx Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install bsd-mailx using apt by running the following command:

sudo apt -y install bsd-mailx

Install bsd-mailx Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install bsd-mailx using aptitude by running the following command:

sudo aptitude -y install bsd-mailx

How To Uninstall bsd-mailx on Ubuntu 20.04

To uninstall only the bsd-mailx package we can use the following command:

sudo apt-get remove bsd-mailx

Uninstall bsd-mailx And Its Dependencies

To uninstall bsd-mailx and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove bsd-mailx

Remove bsd-mailx Configurations and Data

To remove bsd-mailx configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge bsd-mailx

Remove bsd-mailx configuration, data, and all of its dependencies

We can use the following command to remove bsd-mailx configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge bsd-mailx

References

Summary

In this tutorial we learn how to install bsd-mailx package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.