How to Install mailx on Linux

Mailx is an intelligent mail processing system in Linux with good features to send and receive emails. It is a character-based email agent, unlike Gmail, Outlook which is GUI-based. But this doesn’t undermine the importance of this utility.

This is based on Berkeley Mail 8.1 and provides the complete functionality of the POSIX mailx command. Extensions for MIME, IMAP, POP3, SMTP, and S/MIME are also available.

Features of mailx,

  • Enhanced features for interactive use
  • Caching and disconnected operation for IMAP
  • Message threading
  • Scoring, and filtering

Video Tutorial


Install Mailx on Linux

The mailx utility is available as bsd-mailx – simple mail user agent, mailutils – GNU mailutils utilities for handling mail on Ubuntu and other Debian-based distros while Heirloom mailx package for Redhat based system.

The mailx command may not be available on your Linux operating system by default, so you need to install it using the command given below.

Install mailutils/bsd-mailx

Ubuntu, Linux Mint, and other Debian Linux users run the below command to install mailutils package,

sudo apt install mailutils


The below command to install bsd-mailx

sudo apt install bsd-mailx


  • bsd-mailx has some limitations so better to use mailutils package.
  • Heirloom package is not available for Ubuntu

Install mailx

Redhat/CentOS and Fedora Linux Distros run the below command to install mailx,

yum install mailx

Just type mailx on the command prompt to start the utility, if you get the Cannot open mailbox /var/mail/imaginelinux: Permission denied  No mail for imaginelinux error as you are running this command for the first time and the user mailbox is not setup.

Read this article to resolve this error.


Mailx is a command line mail client for Unix-like operating systems. It provides a traditional user interface, but it can be used interactively or in scripts.

You can learn more in this article.

Scroll to Top