Unix mail – clean and reduce size of Inbox using command line and mutt

Clean Inbox in Unix Mail using UNIX command line.

Its preferred to use GUI utility to move and reduce size. Please see instructions for Outlook.

Command line is used for very big folders and cleanup where GUI mail utility, like Outlook, may get stuck.

  • Check that you have enough quota in your home directory of the size of the Inbox.
  • Copy the Inbox to your mail folder in your homedir and the delete old messages in Inbox:
    • Copy Inbox to mail folder: cp –p /var/mail/my-username  ~my-username/mail/inbox-older-2016
    • Clean your inbox:
      • Enter mutt mail utility .
      • To delete older than 1 year messages:
        • Type D (upper case d).
        • Select range of older than 1 year by typing : ~r>1y
          • You can select range older in month : ~r>6m (for 6 month)
        • Check that only older messages are marked with D, as expected.
        • Exit mutt and save changes (delete marked messages) with q
      • Check that Inbox contains the expected messages ( enter mutt or other mail utility).
    • Subscribe the copied folder inbox-older-2016 and clean it as needed.