Dealing With Mail in Mutt

By Juliet Kemp (Send Email)
Posted Nov 9, 2009


Possibly I'm old school, but I still use the command-line mail client mutt to handle my mail. One of mutt's advantages is the wide range of keyboard commands you can use to do various useful tasks. Here's a selection of the ones I use regularly.

Tip of the Trade: The command-line mail client mutt may be old school, but it features a wide range of keyboard commands that can be used for various useful tasks.

  • T: Toggles the visibility of quoted text (any line beginning >). Useful when people haven't trimmed their quotes.
  • l: The limit command. l WORD will show only messages whose From or Subject lines contain WORD. Regular expressions are accepted, and you type l all to view all messages again. Even more usefully, there's a set of mutt-specific patterns prefixed with ~, including:
    • ~N: All new messages.
    • ~p: All messages addressed directly to you (e.g., not mailing lists).
    • ~F: All flagged messages (flag a message by hitting F when it's highlighted in the message index).
    • ~b WORD: All messages with WORD in the body.
  • T: Tag messages matching a pattern. To mark all new messages as read, use this key sequence:
    T ~N ; N ^T ~T
    This tags all new (~N) messages, toggles the New flag (N) on all tagged messages (;), and then untags (^T) all messages matching the 'tagged' pattern (~T). I use this a lot when looking at folders with auto-saved messages.
  • Finally: Not a keystroke but a setting in your .muttrc. This line:
    save-hook example.co.uk =example
    means that when you save a message with a From line anywhere in example.co.uk, you'll be automatically prompted to save it to the folder 'example'. This can be a big time-saving for regular correspondents. Also check out fcc-hook and fcc-save-hook.

Juliet Kemp has been messing around with Linux systems, for financial reward and otherwise, for about a decade. She is also the author of "Linux System Administration Recipes: A Problem-Solution Approach" (Apress, 2009).

Follow ServerWatch on Twitter

Page 1 of 1


Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.