Mail at the command line

Leaner Letter

© Hao Wang, Fotolia

© Hao Wang, Fotolia

Article from Issue 91/2008
Author(s):

The simple mailx command-line mail client handles mail either interactively or via command-line options. Although it lacks the convenience of a GUI-based tool, mailx compares well in scripting.

Thunderbird, Evolution, or Kmail are not the only options as mail clients. Although the major graphical mail clients offer users a great deal of convenience, sometimes a command-line solution is an advantage – both Mutt [1] and the lean mailx [2] program support batch options in the shell.

Most distributions include mailx by default. OpenSUSE and Debian include the package on their installation media. On openSUSE, /bin/mail is a symlink that points to /usr/bin/mailx, whereas Debian systems do things the other way around: /usr/bin/mailx points to /usr/bin/mail. The following commands and command options were all tested on Debian 4.0 "Etch."

Launching the mail client with mailx at the shell prompt takes you into an interactive environment. The client shows the content of your inbox; the default setting for this on most systems is /var/mail/username. Then you will see an overview of the messages, including the sender, date, size, and subject line.

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Mutt for Beginners

    Mutt, a command-line email client, can do anything a desktop client can with less overhead and a smaller attack surface. Here's how to get started.

  • Command Line: at and cron

    The cron and at utilities help automate processes on a Linux system. You can set up automatic backups or even wake up in the morning with a track from your MP3 collection.

  • Monitoring Logfiles

    Logfiles contain records of what happens on a Linux system and the services it runs. Tools like Logcheck and Logsurfer filter out the most important events for the administrator, and they can even trigger an appropriate reaction automatically.

  • Claws Mail

    Sharpen your claws on this powerful and highly configurable email client.

  • Command Line: Processes

    Innumerable processes may be running on your Linux system. We’ll show you how to halt, continue, or kill tasks, and we’ll examine how to send the remnants of crashed programs to the happy hunting grounds.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News