{
    "mode": "man",
    "parameter": "scan",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/scan/1/json",
    "generated": "2026-08-08T10:40:44Z",
    "synopsis": "scan [-help] [-version] [+folder] [msgs] [-clear | -noclear] [-form formatfile] [-format\nstring] [-header | -noheader] [-width columns] [-reverse | -noreverse] [-file filename]",
    "sections": {
        "NAME": {
            "content": "scan - produce a summary listing of nmh messages\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "scan [-help] [-version] [+folder] [msgs] [-clear | -noclear] [-form formatfile] [-format\nstring] [-header | -noheader] [-width columns] [-reverse | -noreverse] [-file filename]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "scan  produces a one-line-per-message listing of the specified folder or messages.  Each scan\nline contains the message number (name), the date, the “From:” field,  the  “Subject”  field,\nand, if room allows, some of the body of the message.  For example:\n\n15+  10/05 crocker    nned  <<Last week I asked some of\n16-  10/05 crocker    message id format  <<I recommend\n18   10/06 brien      Re: Exit status from mkdir\n19   10/07*brien      “scan” listing format in nmh\n\nThe `+' on message 15 indicates that it is the current message.\n\nThe  `-'  on  message  16 indicates that it has been replied to, as indicated by a “Replied:”\ncomponent (produced by the -annotate switch to the repl command).\n\nThe `*' on message 19 indicates that no “Date:” header was present.  The time of last modifi‐\ncation of the message is given instead.\n\nIf there is sufficient room left on the scan line after the subject, the line will be  filled\nwith text from the body, preceded by “<<”, and terminated by “>>” if the body is sufficiently\nshort.  scan actually reads each of the specified messages and parses them to extract the de‐\nsired  fields.  During parsing, appropriate error messages will be produced if there are for‐\nmat errors in any of the messages.\n\nBy default, scan will decode RFC 2047 (MIME) encoding in these scan listings.  scan will only\ndecode these fields if your terminal can natively display the character set used in  the  en‐\ncoding.   You should set the appropriate locale(1) environment variables to your native char‐\nacter set, if it is not US-ASCII.  See locale(1) for more details on the appropriate environ‐\nment variables.\n\nThe switch -reverse, makes scan list the messages in reverse order.\n\nThe -file filename switch allows the user to obtain a scan listing  of  a  mail  drop.   This\nlisting  includes  every  message in the mail drop (you can't scan individual messages).  The\nswitch -reverse is ignored with this option.  If filename is a file, it can  be  in  mbox  or\nMMDF  format,  as  produced  by packf.  If filename is a directory, it is considered to be in\nMaildir format.\n\nThe switch -width columns may be used to specify the width of the scan line.  The default  is\nto use the width of the terminal.\n\nThe  -header switch produces a header line prior to the scan listing.  Currently, the name of\nthe folder and the current date and time are output (see the HISTORY section for more  infor‐\nmation).\n\nIf the -clear switch is used and scan's output is directed to a terminal, then scan will con‐\nsult the environment variables $TERM and $TERMCAP to determine your terminal type in order to\nfind  out  how to clear the screen prior to exiting.  If the -clear switch is used and scan's\noutput is not directed to a terminal (e.g., a pipe or a file), then scan will send a formfeed\nprior to exiting.\n\nFor example, the command:\n\n(scan -clear -header; show all -show pr -f) | lpr\n\nproduces a scan listing of the current folder, followed by a formfeed, followed by a  format‐\nted  listing  of all messages in the folder, one per page.  Omitting “-show pr -f” will cause\nthe messages to be concatenated, separated by a one-line header and two blank lines.\n\nTo override the output format used by scan, the -format string or  -form  file  switches  are\nused.   This  permits  individual  fields of the scan listing to be extracted with ease.  The\nstring is simply a format string and the file is simply a format file.  See mh-format(5)  for\nthe details.\n\nIn  addition  to  the standard mh-format(5) escapes, scan also recognizes the following addi‐\ntional component escapes:\n\nEscape    Returns  Description\nbody      string   the (compressed) first part of the body\ndtimenow  date     the current date\nfolder    string   the name of the current folder\n\n{body} returns a string without MIME decoding, i.e. the MIME boundary separator  may  be  the\nfirst text shown.\n\nIf  no  date  header  is present in the message, the function escapes which operate on {date}\nwill return values for the date of last modification of the message file itself.   This  fea‐\nture  is  handy for scanning a draft folder, as message drafts usually aren't allowed to have\ndates in them.\n\nThe /etc/nmh directory contains several format files as examples of customized scan output.\n\nscan will update the nmh context prior to starting the listing, so interrupting a  long  scan\nlisting preserves the new context.  nmh purists hate this idea.\n",
            "subsections": []
        },
        "FILES": {
            "content": "$HOME/.mhprofile          The user profile\n",
            "subsections": []
        },
        "PROFILE COMPONENTS": {
            "content": "Path:                To determine the user's nmh directory\nAlternate-Mailboxes: To determine the user's mailboxes\nCurrent-Folder:      To find the default current folder\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "pick(1), show(1), mh-format(5)\n",
            "subsections": []
        },
        "DEFAULTS": {
            "content": "`+folder' defaults to the current folder\n`msgs' defaults to all\n`-format' defaulted as described above\n`-noheader'\n`-width' defaulted to the width of the terminal\n",
            "subsections": []
        },
        "CONTEXT": {
            "content": "If a folder is given, it will become the current folder.\n",
            "subsections": []
        },
        "HISTORY": {
            "content": "Prior  to  using  the format string mechanism, -header used to generate a heading saying what\neach column in the listing was.  Format strings prevent this from happening.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "The value of each component escape is set by scan to the contents of the first message header\nscan encounters with the corresponding component name; any following headers  with  the  same\ncomponent name are ignored.\n\nnmh-1.8                                      2020-02-17                                    SCAN(1mh)",
            "subsections": []
        }
    },
    "summary": "scan - produce a summary listing of nmh messages",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "pick",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pick/1/json"
        },
        {
            "name": "show",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/show/1/json"
        },
        {
            "name": "mh-format",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/mh-format/5/json"
        }
    ]
}