Recently I’ve been getting a couple of thousand spam messages in my inbox every day (mostly delivery failures for spam not-from-me). Rather than pull them all the way down to my laptop to delete them, I’m deleting them using Pine after ssh’ing into my hosting account. I’ve found a quick way to delete all messages in the INBOX almost automatically, rather than tagging the messages for deletion individualy.

Here’s what to do:

  1. Enable aggregate command sets in Pine - go to Setup (’S') -> Config (’C') and tick the box for enable-aggregate-command-set.
  2. Exit Setup (’E')
  3. Open the folder list (’L') and open a folder e.g. INBOX.
  4. Hit ‘;’ and you should see “SELECT CRITERIA :” in the status bar.
  5. Hit ‘A’ to select all messages. The status bar should change to something like “[All XXX messages selected] and you should see an ‘X’ at the start of each entry in the message list.
  6. Hit ‘A’ and you should see “APPLY COMMAND :” in the status bar.
  7. Hit ‘D’ to Delete selected messages
  8. Hit ‘X’ to Expunge the deleted messages

Or you could just edit the /var/spool/mail/<USER_NAME> file and delete everything in it using your favourite editor, as I subsequently remembered…