Man Pages



Man Perl

Content-type: text/html Manpage of PERL

PERL

Section: Perl Programmers Reference Guide (1)
Updated: 2006-01-07
Index Return to Main Contents
 

NAME

perl - Practical Extraction and Report Language  

SYNOPSIS

perl  -sTtuUWX ]
        -hv ] [ -V[:configvar] ]
        -cw ] [ -d[t][:debugger] ] [ -D[number/list] ]
        -pna ] [ -Fpattern ] [ -l[octal] ] [ -0[octal/hexadecimal] ]
        -Idir ] [ -m[-]module ] [ -M[-]'module...' ] [ -f ]
        -C [number/list]
        -P ]
        -S ]
        -x[dir] ]
        -i[extension] ]
        -e 'command' ] [ -- ] [ programfile ] [ argument ]...

If you're new to Perl, you should start with perlintro, which is a general intro for beginners and provides some background to help you navigate the rest of Perl's extensive documentation.

For ease of access, the Perl manual has been split up into several sections.  

Overview

    perl                Perl overview (this section)
    perlintro           Perl introduction for beginners
    perltoc             Perl documentation table of contents

 

Tutorials

    perlreftut          Perl references short introduction
    perldsc             Perl data structures intro
    perllol             Perl data structures: arrays of arrays

    perlrequick         Perl regular expressions quick start
    perlretut           Perl regular expressions tutorial

    perlboot            Perl OO tutorial for beginners
    perltoot            Perl OO tutorial, part 1
    perltooc            Perl OO tutorial, part 2
    perlbot             Perl OO tricks and examples

    perlstyle           Perl style guide

    perlcheat           Perl cheat sheet
    perltrap            Perl traps for the unwary
    perldebtut          Perl debugging tutorial

    perlfaq             Perl frequently asked questions
      perlfaq1          General Questions About Perl
      perlfaq2          Obtaining and Learning about Perl
      perlfaq3          Programming Tools
      perlfaq4          Data Manipulation
      perlfaq5          Files and Formats
      perlfaq6          Regexes
      perlfaq7          Perl Language Issues
      perlfaq8          System Interaction
      perlfaq9          Networking

 

Reference Manual

    perlsyn             Perl syntax
    perldata            Perl data structures
    perlop              Perl operators and precedence
    perlsub             Perl subroutines
    perlfunc            Perl built-in functions
      perlopentut       Perl open() tutorial
      perlpacktut       Perl pack() and unpack() tutorial
    perlpod             Perl plain old documentation
    perlpodspec         Perl plain old documentation format specification
    perlrun             Perl execution and options
    perldiag            Perl diagnostic messages
    perllexwarn         Perl warnings and their control
    perldebug           Perl debugging
    perlvar             Perl predefined variables
    perlre              Perl regular expressions, the rest of the story
    perlreref           Perl regular expressions quick reference
    perlref             Perl references, the rest of the story
    perlform            Perl formats
    perlobj             Perl objects
    perltie             Perl objects hidden behind simple variables
      perldbmfilter     Perl DBM filters

    perlipc             Perl interprocess communication
    perlfork            Perl fork() information
    perlnumber          Perl number semantics

    perlthrtut          Perl threads tutorial
      perlothrtut       Old Perl threads tutorial

    perlport            Perl portability guide
    perllocale          Perl locale support
    perluniintro        Perl Unicode introduction
    perlunicode         Perl Unicode support
    perlebcdic          Considerations for running Perl on EBCDIC platforms

    perlsec             Perl security

    perlmod             Perl modules: how they work
    perlmodlib          Perl modules: how to write and use
    perlmodstyle        Perl modules: how to write modules with style
    perlmodinstall      Perl modules: how to install from CPAN
    perlnewmod          Perl modules: preparing a new module for distribution

    perlutil            utilities packaged with the Perl distribution

    perlcompile         Perl compiler suite intro

    perlfilter          Perl source filters

    perlglossary        Perl Glossary

 

Internals and C Language Interface

    perlembed           Perl ways to embed perl in your C or C++ application
    perldebguts         Perl debugging guts and tips
    perlxstut           Perl XS tutorial
    perlxs              Perl XS application programming interface
    perlclib            Internal replacements for standard C library functions
    perlguts            Perl internal functions for those doing extensions
    perlcall            Perl calling conventions from C

    perlapi             Perl API listing (autogenerated)
    perlintern          Perl internal functions (autogenerated)
    perliol             C API for Perl's implementation of IO in Layers
    perlapio            Perl internal IO abstraction interface

    perlhack            Perl hackers guide

 

Miscellaneous

    perlbook            Perl book information
    perltodo            Perl things to do

    perldoc             Look up Perl documentation in Pod format

    perlhist            Perl history records
    perldelta           Perl changes since previous version
    perl587delta        Perl changes in version 5.8.7
    perl586delta        Perl changes in version 5.8.6
    perl585delta        Perl changes in version 5.8.5
    perl584delta        Perl changes in version 5.8.4
    perl583delta        Perl changes in version 5.8.3
    perl582delta        Perl changes in version 5.8.2
    perl581delta        Perl changes in version 5.8.1
    perl58delta         Perl changes in version 5.8.0
    perl573delta        Perl changes in version 5.7.3
    perl572delta        Perl changes in version 5.7.2
    perl571delta        Perl changes in version 5.7.1
    perl570delta        Perl changes in version 5.7.0
    perl561delta        Perl changes in version 5.6.1
    perl56delta         Perl changes in version 5.6
    perl5005delta       Perl changes in version 5.005
    perl5004delta       Perl changes in version 5.004

    perlartistic        Perl Artistic License
    perlgpl             GNU General Public License

 

Language-Specific

    perlcn              Perl for Simplified Chinese (in EUC-CN)
    perljp              Perl for Japanese (in EUC-JP)
    perlko              Perl for Korean (in EUC-KR)
    perltw              Perl for Traditional Chinese (in Big5)

 

Platform-Specific

    perlaix             Perl notes for AIX
    perlamiga           Perl notes for AmigaOS
    perlapollo          Perl notes for Apollo DomainOS
    perlbeos            Perl notes for BeOS
    perlbs2000          Perl notes for POSIX-BC BS2000
    perlce              Perl notes for WinCE
    perlcygwin          Perl notes for Cygwin
    perldgux            Perl notes for DG/UX
    perldos             Perl notes for DOS
    perlepoc            Perl notes for EPOC
    perlfreebsd         Perl notes for FreeBSD
    perlhpux            Perl notes for HP-UX
    perlhurd            Perl notes for Hurd
    perlirix            Perl notes for Irix
    perllinux           Perl notes for Linux
    perlmachten         Perl notes for Power MachTen
    perlmacos           Perl notes for Mac OS (Classic)
    perlmacosx          Perl notes for Mac OS X
    perlmint            Perl notes for MiNT
    perlmpeix           Perl notes for MPE/iX
    perlnetware         Perl notes for NetWare
    perlopenbsd         Perl notes for OpenBSD
    perlos2             Perl notes for OS/2
    perlos390           Perl notes for OS/390
    perlos400           Perl notes for OS/400
    perlplan9           Perl notes for Plan 9
    perlqnx             Perl notes for QNX
    perlsolaris         Perl notes for Solaris
    perltru64           Perl notes for Tru64
    perluts             Perl notes for UTS
    perlvmesa           Perl notes for VM/ESA
    perlvms             Perl notes for VMS
    perlvos             Perl notes for Stratus VOS
    perlwin32           Perl notes for Windows

By default, the manpages listed above are installed in the /usr/local/man/ directory.

Extensive additional documentation for Perl modules is available. The default configuration for perl will place this additional documentation in the /usr/local/lib/perl5/man directory (or else in the man subdirectory of the Perl library directory). Some of this additional documentation is distributed standard with Perl, but you'll also find documentation for third-party modules there.

You should be able to view Perl's documentation with your man(1) program by including the proper directories in the appropriate start-up files, or in the MANPATH environment variable. To find out where the configuration has installed the manpages, type:

    perl -V:man.dir

If the directories have a common stem, such as /usr/local/man/man1 and /usr/local/man/man3, you need only to add that stem (/usr/local/man) to your man(1) configuration files or your MANPATH environment variable. If they do not share a stem, you'll have to add both stems.

If that doesn't work for some reason, you can still use the supplied perldoc script to view module information. You might also look into getting a replacement man program.

If something strange has gone wrong with your program and you're not sure where you should look for help, try the -w switch first. It will often point out exactly where the trouble is.  

DESCRIPTION

Perl is a language optimized for scanning arbitrary text files, extracting information from those text files, and printing reports based on that information. It's also a good language for many system management tasks. The language is intended to be practical (easy to use, efficient, complete) rather than beautiful (tiny, elegant, minimal).

Perl combines (in the author's opinion, anyway) some of the best features of C, sed, awk, and sh, so people familiar with those languages should have little difficulty with it. (Language historians will also note some vestiges of csh, Pascal, and even BASIC-PLUS.) Expression syntax corresponds closely to C expression syntax. Unlike most Unix utilities, Perl does not arbitrarily limit the size of your data---if you've got the memory, Perl can slurp in your whole file as a single string. Recursion is of unlimited depth. And the tables used by hashes (sometimes called ``associative arrays'') grow as necessary to prevent degraded performance. Perl can use sophisticated pattern matching techniques to scan large amounts of data quickly. Although optimized for scanning text, Perl can also deal with binary data, and can make dbm files look like hashes. Setuid Perl scripts are safer than C programs through a dataflow tracing mechanism that prevents many stupid security holes.

If you have a problem that would ordinarily use sed or awk or sh, but it exceeds their capabilities or must run a little faster, and you don't want to write the silly thing in C, then Perl may be for you. There are also translators to turn your sed and awk scripts into Perl scripts.

But wait, there's more...

Begun in 1993 (see perlhist), Perl version 5 is nearly a complete rewrite that provides the following additional benefits:

*
modularity and reusability using innumerable modules

Described in perlmod, perlmodlib, and perlmodinstall.

*
embeddable and extensible

Described in perlembed, perlxstut, perlxs, perlcall, perlguts, and xsubpp.

*
roll-your-own magic variables (including multiple simultaneous DBM implementations)

Described in perltie and AnyDBM_File.

*
subroutines can now be overridden, autoloaded, and prototyped

Described in perlsub.

*
arbitrarily nested data structures and anonymous functions

Described in perlreftut, perlref, perldsc, and perllol.

*
object-oriented programming

Described in perlobj, perlboot, perltoot, perltooc, and perlbot.

*
support for light-weight processes (threads)

Described in perlthrtut and threads.

*
support for Unicode, internationalization, and localization

Described in perluniintro, perllocale and Locale::Maketext.

*
lexical scoping

Described in perlsub.

*
regular expression enhancements

Described in perlre, with additional examples in perlop.

*
enhanced debugger and interactive Perl environment, with integrated editor support

Described in perldebtut, perldebug and perldebguts.

*
POSIX 1003.1 compliant library

Described in POSIX.

Okay, that's definitely enough hype.  

AVAILABILITY

Perl is available for most operating systems, including virtually all Unix-like platforms. See ``Supported Platforms'' in perlport for a listing.  

ENVIRONMENT

See perlrun.  

AUTHOR

Larry Wall <larry@wall.org>, with the help of oodles of other folks.

If your Perl success stories and testimonials may be of help to others who wish to advocate the use of Perl in their applications, or if you wish to simply express your gratitude to Larry and the Perl developers, please write to perl-thanks@perl.org .  

FILES

 "@INC"                 locations of perl libraries

 

SEE ALSO

 a2p    awk to perl translator
 s2p    sed to perl translator

 http://www.perl.org/       the Perl homepage
 http://www.perl.com/       Perl articles (O'Reilly)
 http://www.cpan.org/       the Comprehensive Perl Archive
 http://www.pm.org/         the Perl Mongers

 

DIAGNOSTICS

The "use warnings" pragma (and the -w switch) produces some lovely diagnostics.

See perldiag for explanations of all Perl's diagnostics. The "use diagnostics" pragma automatically turns Perl's normally terse warnings and errors into these longer forms.

Compilation errors will tell you the line number of the error, with an indication of the next token or token type that was to be examined. (In a script passed to Perl via -e switches, each -e is counted as one line.)

Setuid scripts have additional constraints that can produce error messages such as ``Insecure dependency''. See perlsec.

Did we mention that you should definitely consider using the -w switch?  

BUGS

The -w switch is not mandatory.

Perl is at the mercy of your machine's definitions of various operations such as type casting, atof(), and floating-point output with sprintf().

If your stdio requires a seek or eof between reads and writes on a particular stream, so does Perl. (This doesn't apply to sysread() and syswrite().)

While none of the built-in data types have any arbitrary size limits (apart from memory size), there are still a few arbitrary limits: a given variable name may not be longer than 251 characters. Line numbers displayed by diagnostics are internally stored as short integers, so they are limited to a maximum of 65535 (higher numbers usually being affected by wraparound).

You may mail your bug reports (be sure to include full configuration information as output by the myconfig program in the perl source tree, or by "perl -V") to perlbug@perl.org . If you've succeeded in compiling perl, the perlbug script in the utils/ subdirectory can be used to help mail in a bug report.

Perl actually stands for Pathologically Eclectic Rubbish Lister, but don't tell anyone I said that.  

NOTES

The Perl motto is ``There's more than one way to do it.'' Divining how many more is left as an exercise to the reader.

The three principal virtues of a programmer are Laziness, Impatience, and Hubris. See the Camel Book for why.


 

Index

NAME
SYNOPSIS
Overview
Tutorials
Reference Manual
Internals and C Language Interface
Miscellaneous
Language-Specific
Platform-Specific
DESCRIPTION
AVAILABILITY
ENVIRONMENT
AUTHOR
FILES
SEE ALSO
DIAGNOSTICS
BUGS
NOTES

This document was created by man2html, using the manual pages.
Time: 15:01:43 GMT, June 17, 2008

Man Muttrc

Manpage of muttrc

muttrc

Section: User Manuals (5)
Updated: September 2002
Index Return to Main Contents
 

NAME

muttrc - Configuration file for the Mutt Mail User Agent  

DESCRIPTION

A mutt configuration file consists of a series of lqcommandsrq. Each line of the file may contain one or more commands. When multiple commands are used, they must be separated by a semicolon (lq;rq).

The hash mark, or pound sign (lq#rq), is used as a lqcommentrq character. You can use it to annotate your initialization file. All text after the comment character to the end of the line is ignored.

Single quotes (lq'rq) and double quotes (lq"rq) can be used to quote strings which contain spaces or other special characters. The difference between the two types of quotes is similar to that of many popular shell programs, namely that a single quote is used to specify a literal string (one that is not interpreted for shell variables or quoting with a backslash [see next paragraph]), while double quotes indicate a string which should be evaluated. For example, backquotes are evaluated inside of double quotes, but not single quotes.

rs quotes the next character, just as in shells such as bash and zsh. For example, if want to put quotes (lq"rq) inside of a string, you can use lqrsrq to force the next character to be a literal instead of interpreted character.

lqrsrsrq means to insert a literal lqrsrq into the line. lqrsnrq and lqrsrrq have their usual C meanings of linefeed and carriage-return, respectively.

A lqrsrq at the end of a line can be used to split commands over multiple lines, provided that the split points don't appear in the middle of command names.

It is also possible to substitute the output of a Unix command in an initialization file. This is accomplished by enclosing the command in backquotes (`command`).

UNIX environment variables can be accessed like the way it is done in shells like sh and bash: Prepend the name of the variable by a dollar (lqDorq) sign.

 

COMMANDS

alias [-group name [...]] key address [, address [ ... ]]
unalias [ *  | key ]
alias defines an alias key for the given addresses. Each address will be resolved into either an email address (user@example.com) or a named email address (User Name <user@example.com>). The address may be specified in either format, or in the format lquser@example.com (User Name)rq. unalias removes the alias corresponding to the given key or all aliases when lq*rq is used as an argument. The optional -group argument to alias causes the aliased address(es) to be added to the named group.

group [-group name] [-rx EXPR [ ... ]] [-addr address [ ... ]]
ungroup [-group name ] [ * | [[-rx EXPR [ ... ]] [-addr address [ ... ]]]
group is used to directly add either addresses or regular expressions to the specified group or groups. The different categories of arguments to the group command can be in any order. The flags -rx and -addr specify what the following strings (that cannot begin with a hyphen) should be interpreted as: either a regular expression or an email address, respectively. ungroup is used to remove addresses or regular expressions from the specified group or groups. The syntax is similar to the group command, however the special character * can be used to empty a group of all of its contents.
These address groups can also be created implicitely by the alias, lists, subscribe and alternates commands by specifying the optional -group option.
Once defined, these address groups can be used in patterns to search for and limit the display to messages matching a group.

alternates [-group name] regexp [ , regexp [ ... ]]
unalternates [ *  | regexp [ , regexp [ ... ]] ]
alternates is used to inform mutt about alternate addresses where you receive mail; you can use regular expressions to specify alternate addresses. This affects mutt's idea about messages from you, and messages addressed to you. unalternates removes a regular expression from the list of known alternates. The -group flag causes all of the subsequent regular expressions to be added to the named group.

alternative_order type[/subtype] [ ... ]
unalternative_order [ *  | type/subtype] [...]
alternative_order command permits you to define an order of preference which is used by mutt to determine which part of a multipart/alternative body to display. A subtype of lq*rq matches any subtype, as does an empty subtype. unalternative_order removes entries from the ordered list or deletes the entire list when lq*rq is used as an argument.

auto_view type[/subtype] [ ... ]
unauto_view type[/subtype] [ ... ]
This commands permits you to specify that mutt should automatically convert the given MIME types to text/plain when displaying messages. For this to work, there must be a mailcap(5) entry for the given MIME type with the copiousoutput flag set. A subtype of lq*rq matches any subtype, as does an empty subtype.

mime_lookup type[/subtype] [ ... ]
unmime_lookup type[/subtype] [ ... ]
This command permits you to define a list of "data" MIME content types for which mutt will try to determine the actual file type from the file name, and not use a mailcap(5) entry given for the original MIME type. For instance, you may add the application/octet-stream MIME type to this list.
bind map1,map2,... key function
This command binds the given key for the given map or maps to the given function. Multiple maps may be specified by separating them with commas (no whitespace is allowed).
Valid maps are: generic, alias, attach, browser, editor, index, compose, pager, pgp, postpone, mix.
For more information on keys and functions, please consult the Mutt Manual.
account-hook [!]regexp command
This hook is executed whenever you access a remote mailbox. Useful to adjust configuration settings to different IMAP or POP servers.
charset-hook alias charset
This command defines an alias for a character set. This is useful to properly display messages which are tagged with a character set name not known to mutt.
iconv-hook charset local-charset
This command defines a system-specific name for a character set. This is useful when your system's iconv(3) implementation does not understand MIME character set names (such as iso-8859-1), but instead insists on being fed with implementation-specific character set names (such as 8859-1). In this specific case, you'd put this into your configuration file:
iconv-hook iso-8859-1 8859-1
message-hook [!]pattern command
Before mutt displays (or formats for replying or forwarding) a message which matches the given pattern (or, when it is preceded by an exclamation mark, does not match the pattern), the given command is executed. When multiple message-hooks match, they are executed in the order in which they occur in the configuration file.
folder-hook [!]regexp command
When mutt enters a folder which matches regexp (or, when regexp is preceded by an exclamation mark, does not match regexp), the given command is executed.
When several folder-hooks match a given mail folder, they are executed in the order given in the configuration file.
macro map key sequence [ description ]
This command binds the given sequence of keys to the given key in the given map or maps. For valid maps, see bind. To specify multiple maps, put only a comma between the maps.

color object foreground background [  regexp ]
color index foreground background [  pattern ]
uncolor index pattern [ pattern ... ]
If your terminal supports color, these commands can be used to assign foreground/backgound combinations to certain objects. Valid objects are: attachment, body, bold, header, hdrdefault, index, indicator, markers, message, normal, quoted, quotedN, search, signature, status, tilde, tree, underline. The body and header objects allow you to restrict the colorization to a regular expression. The index object permits you to select colored messages by pattern.
Valid colors include: white, black, green, magenta, blue, cyan, yellow, red, default, colorN.

mono object attribute [ regexp ]
mono index attribute [ pattern ]
For terminals which don't support color, you can still assign attributes to objects. Valid attributes include: none, bold, underline, reverse, and standout.
[un]ignore pattern [ pattern ... ]
The ignore command permits you to specify header fields which you usually don't wish to see. Any header field whose tag begins with an lqignoredrq pattern will be ignored.
The unignore command permits you to define exceptions from the above mentioned list of ignored headers.

lists [-group name] regexp [ regexp ... ]
unlists regexp [ regexp ... ]
subscribe [-group name] regexp [ regexp ... ]
unsubscribe regexp [ regexp ... ]
Mutt maintains two lists of mailing list address patterns, a list of subscribed mailing lists, and a list of known mailing lists. All subscribed mailing lists are known. Patterns use regular expressions.
The lists command adds a mailing list address to the list of known mailing lists. The unlists command removes a mailing list from the lists of known and subscribed mailing lists. The subscribe command adds a mailing list to the lists of known and subscribed mailing lists. The unsubscribe command removes it from the list of subscribed mailing lists. The -group flag adds all of the subsequent regular expressions to the named group.
mbox-hook [!]pattern mailbox
When mutt changes to a mail folder which matches pattern, mailbox will be used as the lqmboxrq folder, i.e., read messages will be moved to that folder when the mail folder is left.
The first matching mbox-hook applies.

mailboxes filename [ filename ... ]
unmailboxes [ * | filename ... ]
The mailboxes specifies folders which can receive mail and which will be checked for new messages. When changing folders, pressing space will cycle through folders with new mail. The unmailboxes command is used to remove a file name from the list of folders which can receive mail. If "*" is specified as the file name, the list is emptied.

my_hdr string
unmy_hdr field
Using my_hdr, you can define headers which will be added to the messages you compose. unmy_hdr will remove the given user-defined headers.
hdr_order header1 header2 [ ... ]
With this command, you can specify an order in which mutt will attempt to present headers to you when viewing messages.
save-hook [!]pattern filename
When a message matches pattern, the default file name when saving it will be the given filename.
fcc-hook [!]pattern filename
When an outgoing message matches pattern, the default file name for storing a copy (fcc) will be the given filename.
fcc-save-hook [!]pattern filename
This command is an abbreviation for identical fcc-hook and save-hook commands.
send-hook [!]pattern command
When composing a message matching pattern, command is executed. When multiple send-hooks match, they are executed in the order in which they occur in the configuration file.
send2-hook [!]pattern command
Whenever a message matching pattern is changed (either by editing it or by using the compose menu), command is executed. When multiple send2-hooks match, they are executed in the order in which they occur in the configuration file. Possible applications include setting the $sendmail variable when a message's from header is changed.
send2-hook execution is not triggered by use of enter-command from the compose menu.
reply-hook [!]pattern command
When replying to a message matching pattern, command is executed. When multiple reply-hooks match, they are executed in the order in which they occur in the configuration file, but all reply-hooks are matched and executed before send-hooks, regardless of their order in the configuration file.
crypt-hook pattern key-id
The crypt-hook command provides a method by which you can specify the ID of the public key to be used when encrypting messages to a certain recipient. The meaning of "key ID" is to be taken broadly: This can be a different e-mail address, a numerical key ID, or even just an arbitrary search string.
push string
This command adds the named string to the keyboard buffer.

set [no|inv|&|?]variable[=value] [ ... ]
toggle variable [ ... ]
unset variable [ ... ]
reset variable [ ... ]
These commands are used to set and manipulate configuration varibles.
Mutt knows four basic types of variables: boolean, number, string and quadoption. Boolean variables can be set (true), unset (false), or toggled. Number variables can be assigned a positive integer value.
String variables consist of any number of printable characters. Strings must be enclosed in quotes if they contain spaces or tabs. You may also use the lqCrq escape sequences \n and \t for newline and tab, respectively.
Quadoption variables are used to control whether or not to be prompted for certain actions, or to specify a default action. A value of yes will cause the action to be carried out automatically as if you had answered yes to the question. Similarly, a value of no will cause the the action to be carried out as if you had answered lqno.rq A value of ask-yes will cause a prompt with a default answer of lqyesrq and ask-no will provide a default answer of lqno.rq
The reset command resets all given variables to the compile time defaults. If you reset the special variable all, all variables will reset to their compile time defaults.
source filename
The given file will be evaluated as a configuration file.
spam pattern format nospam pattern
These commands define spam-detection patterns from external spam filters, so that mutt can sort, limit, and search on ``spam tags'' or ``spam attributes'', or display them in the index. See the Mutt manual for details.
unhook [ * | hook-type ]
This command will remove all hooks of a given type, or all hooks when lq*rq is used as an argument. hook-type can be any of the -hook commands documented above.
 

PATTERNS

In various places with mutt, including some of the abovementioned hook commands, you can specify patterns to match messages.  

Constructing Patterns

A simple pattern consists of an operator of the form lq~characterrq, possibly followed by a parameter against which mutt is supposed to match the object specified by this operator. For some characters, the ~ may be replaced by another character to alter the behavior of the match. These are described in the list of operators, below.

With some of these operators, the object to be matched consists of several e-mail addresses. In these cases, the object is matched if at least one of these e-mail addresses matches. You can prepend a hat (lq^rq) character to such a pattern to indicate that all addresses must match in order to match the object.

You can construct complex patterns by combining simple patterns with logical operators. Logical AND is specified by simply concatenating two simple patterns, for instance lq~C mutt-dev ~s bugrq. Logical OR is specified by inserting a vertical bar (lq|rq) between two patterns, for instance lq~C mutt-dev | ~s bugrq. Additionally, you can negate a pattern by prepending a bang (lq!rq) character. For logical grouping, use braces (lq()rq). Example: lq!(~t mutt|~c mutt) ~f elkinsrq.  

Simple Patterns

Mutt understands the following simple patterns:

~A
all messages
~b EXPR
messages which contain EXPR in the message body.
=b STRING
messages which contain STRING in the message body. If IMAP is enabled, searches for STRING on the server, rather than downloading each message and searching it locally.
~B EXPR
messages which contain EXPR in the whole message.
~c EXPR
messages carbon-copied to EXPR
%c GROUP
messages carbon-copied to any member of GROUP
~C EXPR
messages either to: or cc: EXPR
%C GROUP
messages either to: or cc: to any member of GROUP
~d MIN-MAX
messages with lqdate-sentrq in a Date range
~D
deleted messages
~e EXPR
messages which contain EXPR in the lqSenderrq field
%e GROUP
messages which contain a member of GROUP in the lqSenderrq field
~E
expired messages
~f EXPR
messages originating from EXPR
%f GROUP
messages originating form any member of GROUP
~F
flagged messages
~g
PGP signed messages
~G
PGP encrypted messages
~h EXPR
messages which contain EXPR in the message header
~H EXPR
messages with spam tags matching EXPR
~i EXPR
messages which match EXPR in the lqMessage-IDrq field
~k
messages containing PGP key material
~l
messages addressed to a known mailing list (defined by either subscribe or list)
~L EXPR
messages either originated or received by EXPR
%L GROUP
messages either originated or received by any member of GROUP
~m MIN-MAX
message in the range MIN to MAX
~n MIN-MAX
messages with a score in the range MIN to MAX
~N
new messages
~O
old messages
~p
messages addressed to you (as defined by alternates)
~P
messages from you (as defined by alternates)
~Q
messages which have been replied to
~r MIN-MAX
messages with lqdate-receivedrq in a Date range
~R
read messages
~s EXPR
messages having EXPR in the lqSubjectrq field.
~S
superseded messages
~t EXPR
messages addressed to EXPR
~T
tagged messages
~u
messages addressed to a subscribed mailing list (defined by subscribe commands)
~U
unread messages
~v
message is part of a collapsed thread.
~V
cryptographically verified messages
~x EXPR
messages which contain EXPR in the lqReferencesrq field
~X MIN-MAX
messages with MIN - MAX attachments
~y EXPR
messages which contain EXPR in the lqX-Labelrq field
~z MIN-MAX
messages with a size in the range MIN to MAX
~=
duplicated messages (see $duplicate_threads)
~$
unreferenced message (requries threaded view)
~(PATTERN)
messages in threads containing messages matching a certain pattern, e.g. all threads containing messages from you: ~(~P)

In the above, EXPR is a regular expression.

With the ~m, ~n, ~X, and ~z operators, you can also specify ranges in the forms <MAX, >MIN, MIN-, and -MAX.  

Matching dates

The ~d and ~r operators are used to match date ranges, which are interpreted to be given in your local time zone.

A date is of the form DD[/MM[/[cc]YY]], that is, a two-digit date, optionally followed by a two-digit month, optionally followed by a year specifications. Omitted fields default to the current month and year.

Mutt understands either two or four digit year specifications. When given a two-digit year, mutt will interpret values less than 70 as lying in the 21st century (i.e., lq38rq means 2038 and not 1938, and lq00rq is interpreted as 2000), and values greater than or equal to 70 as lying in the 20th century.

Note that this behaviour is Y2K compliant, but that mutt does have a Y2.07K problem.

If a date range consists of a single date, the operator in question will match that precise date. If the date range consists of a dash (lq-rq), followed by a date, this range will match any date before and up to the date given. Similarly, a date followed by a dash matches the date given and any later point of time. Two dates, separated by a dash, match any date which lies in the given range of time.

You can also modify any absolute date by giving an error range. An error range consists of one of the characters +, -, *, followed by a positive number, followed by one of the unit characters y, m, w, or d, specifying a unit of years, months, weeks, or days. + increases the maximum date matched by the given interval of time, - decreases the minimum date matched by the given interval of time, and * increases the maximum date and decreases the minimum date matched by the given interval of time. It is possible to give multiple error margins, which cumulate. Example: 1/1/2001-1w+2w*3d

You can also specify offsets relative to the current date. An offset is specified as one of the characters <, >, =, followed by a positive number, followed by one of the unit characters y, m, w, or d. > matches dates which are older than the specified amount of time, an offset which begins with the character < matches dates which are more recent than the specified amount of time, and an offset which begins with the character = matches points of time which are precisely the given amount of time ago.  

CONFIGURATION VARIABLES

abort_nosubject
Type: quadoption
Default: ask-yes
If set to yes, when composing messages and no subject is given at the subject prompt, composition will be aborted. If set to no, composing messages with no subject given at the subject prompt will never be aborted.

abort_unmodified
Type: quadoption
Default: yes
If set to yes, composition will automatically abort after editing the message body if no changes are made to the file (this check only happens after the first edit of the file). When set to no, composition will never be aborted.

alias_file
Type: path
Default: lq~/.muttrcrq
The default file in which to save aliases created by the lqcreate-aliasrq function.
Note: Mutt will not automatically source this file; you must explicitly use the lqsourcerq command for it to be executed.
The default for this option is the currently used muttrc file, or lq~/.muttrcrq if no user muttrc was found.

alias_format
Type: string
Default: lq%4n %2f %t %-10a   %rrq
Specifies the format of the data displayed for the `alias' menu. The following printf(3)-style sequences are available:
%a
alias name
%f
flags - currently, a rqdrq for an alias marked for deletion
%n
index number
%r
address which alias expands to
%t
character which indicates if the alias is tagged for inclusion

allow_8bit
Type: boolean
Default: yes
Controls whether 8-bit data is converted to 7-bit using either Quoted- Printable or Base64 encoding when sending mail.

allow_ansi
Type: boolean
Default: no
Controls whether ANSI color codes in messages (and color tags in rich text messages) are to be interpreted. Messages containing these codes are rare, but if this option is set, their text will be colored accordingly. Note that this may override your color choices, and even present a security problem, since a message could include a line like rq[-- PGP output follows ...rq and give it the same color as your attachment color.

arrow_cursor
Type: boolean
Default: no
When set, an arrow (lq->rq) will be used to indicate the current entry in menus instead of highlighting the whole line. On slow network or modem links this will make response faster because there is less that has to be redrawn on the screen when moving to the next or previous entries in the menu.

ascii_chars
Type: boolean
Default: no
If set, Mutt will use plain ASCII characters when displaying thread and attachment trees, instead of the default ACS characters.

askbcc
Type: boolean
Default: no
If set, Mutt will prompt you for blind-carbon-copy (Bcc) recipients before editing an outgoing message.

askcc
Type: boolean
Default: no
If set, Mutt will prompt you for carbon-copy (Cc) recipients before editing the body of an outgoing message.

assumed_charset
Type: string
Default: lqrq
This variable is a colon-separated list of character encoding schemes for messages without character encoding indication. Header field values and message body content without character encoding indication would be assumed that they are written in one of this list. By default, all the header fields and message body without any charset indication are assumed to be in rqus-asciirq.
For example, Japanese users might prefer this:
set assumed_charset=rqiso-2022-jp:euc-jp:shift_jis:utf-8rq
However, only the first content is valid for the message body.

attach_charset
Type: string
Default: lqrq
This variable is a colon-separated list of character encoding schemes for text file attachments. If unset, $charset value will be used instead. For example, the following configuration would work for Japanese text handling:
set attach_charset=rqiso-2022-jp:euc-jp:shift_jis:utf-8rq
Note: rqiso-2022-*rq must be put at the head of the value as shown above if included.

attach_format
Type: string
Default: lq%u%D%I %t%4n %T%.40d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] rq
This variable describes the format of the `attachment' menu. The following printf-style sequences are understood:
%C
charset
%c
requires charset conversion (n or c)
%D
deleted flag
%d
description
%e
MIME content-transfer-encoding
%f
filename
%I
disposition (I=inline, A=attachment)
%m
major MIME type
%M
MIME subtype
%n
attachment number
%Q
rqQrq, if MIME part qualifies for attachment counting
%s
size
%t
tagged flag
%T
graphic tree characters
%u
unlink (=to delete) flag
%X
number of qualifying MIME parts in this part and its children (please see the lqattachmentsrq section for possible speed effects)
%>X
right justify the rest of the string and pad with character rqXrq
%|X
pad to the end of the line with character rqXrq
%*X
soft-fill with character rqXrq as pad
For an explanation of `soft-fill', see the lq$index_formatrq documentation.

attach_sep
Type: string
Default: lq\nrq
The separator to add between attachments when operating (saving, printing, piping, etc) on a list of tagged attachments.

attach_split
Type: boolean
Default: yes
If this variable is unset, when operating (saving, printing, piping, etc) on a list of tagged attachments, Mutt will concatenate the attachments and will operate on them as a single attachment. The lq$attach_seprq separator is added after each attachment. When set, Mutt will operate on the attachments one by one.

attribution
Type: string
Default: lqOn %d, %n wrote:rq
This is the string that will precede a message which has been included in a reply. For a full listing of defined printf()-like sequences see the section on lq$index_formatrq.

autoedit
Type: boolean
Default: no
When set along with lq$edit_headersrq, Mutt will skip the initial send-menu and allow you to immediately begin editing the body of your message. The send-menu may still be accessed once you have finished editing the body of your message.
Also see lq$fast_replyrq.

auto_tag
Type: boolean
Default: no
When set, functions in the index menu which affect a message will be applied to all tagged messages (if there are any). When unset, you must first use the tag-prefix function (default: rq;rq) to make the next function apply to all tagged messages.

beep
Type: boolean
Default: yes
When this variable is set, mutt will beep when an error occurs.

beep_new
Type: boolean
Default: no
When this variable is set, mutt will beep whenever it prints a message notifying you of new mail. This is independent of the setting of the lq$beeprq variable.

bounce
Type: quadoption
Default: ask-yes
Controls whether you will be asked to confirm bouncing messages. If set to yes you don't get asked if you want to bounce a message. Setting this variable to no is not generally useful, and thus not recommended, because you are unable to bounce messages.

bounce_delivered
Type: boolean
Default: yes
When this variable is set, mutt will include Delivered-To headers when bouncing messages. Postfix users may wish to unset this variable.

braille_friendly
Type: boolean
Default: no
When this variable is set, mutt will place the cursor at the beginning of the current line in menus, even when the arrow_cursor variable is unset, making it easier for blind persons using Braille displays to follow these menus. The option is disabled by default because many visual terminals don't permit making the cursor invisible.

check_mbox_size
Type: boolean
Default: no
When this variable is set, mutt will use file size attribute instead of access time when checking for new mail.

charset
Type: string
Default: lqrq
Character set your terminal uses to display and enter textual data. It is also the fallback for $send_charset.

check_new
Type: boolean
Default: yes
Note: this option only affects maildir and MH style mailboxes.
When set, Mutt will check for new mail delivered while the mailbox is open. Especially with MH mailboxes, this operation can take quite some time since it involves scanning the directory and checking each file to see if it has already been looked at. If check_new is unset, no check for new mail is performed while the mailbox is open.

collapse_unread
Type: boolean
Default: yes
When unset, Mutt will not collapse a thread if it contains any unread messages.

uncollapse_jump
Type: boolean
Default: no
When set, Mutt will jump to the next unread message, if any, when the current thread is uncollapsed.

compose_format
Type: string
Default: lq-- Mutt: Compose  [Approx. msg size: %l   Atts: %a]%>-rq
Controls the format of the status line displayed in the Compose menu. This string is similar to lq$status_formatrq, but has its own set of printf()-like sequences:
%a
total number of attachments
%h
local hostname
%l
approximate size (in bytes) of the current message
%v
Mutt version string
See the text describing the lq$status_formatrq option for more information on how to set lq$compose_formatrq.

config_charset
Type: string
Default: lqrq
When defined, Mutt will recode commands in rc files from this encoding.

confirmappend
Type: boolean
Default: yes
When set, Mutt will prompt for confirmation when appending messages to an existing mailbox.

confirmcreate
Type: boolean
Default: yes
When set, Mutt will prompt for confirmation when saving messages to a mailbox which does not yet exist before creating it.

connect_timeout
Type: number
Default: 30
Causes Mutt to timeout a network connection (for IMAP or POP) after this many seconds if the connection is not able to be established. A negative value causes Mutt to wait indefinitely for the connection to succeed.

content_type
Type: string
Default: lqtext/plainrq
Sets the default Content-Type for the body of newly composed messages.

copy
Type: quadoption
Default: yes
This variable controls whether or not copies of your outgoing messages will be saved for later references. Also see lq$recordrq, lq$save_namerq, lq$force_namerq and lqfcc-hookrq.

crypt_use_gpgme
Type: boolean
Default: no
This variable controls the use of the GPGME-enabled crypto backends. If it is set and Mutt was built with gpgme support, the gpgme code for S/MIME and PGP will be used instead of the classic code. Note that you need to set this option in .muttrc; it won't have any effect when used interactively.

crypt_use_pka
Type: boolean
Default: no
(http://www.g10code.de/docs/pka-intro.de.pdf) during signature verification (only supported by the GPGME backend).

crypt_autopgp
Type: boolean
Default: yes
This variable controls whether or not mutt may automatically enable PGP encryption/signing for messages. See also lq$crypt_autoencryptrq, lq$crypt_replyencryptrq, lq$crypt_autosignrq, lq$crypt_replysignrq and lq$smime_is_defaultrq.

crypt_autosmime
Type: boolean
Default: yes
This variable controls whether or not mutt may automatically enable S/MIME encryption/signing for messages. See also lq$crypt_autoencryptrq, lq$crypt_replyencryptrq, lq$crypt_autosignrq, lq$crypt_replysignrq and lq$smime_is_defaultrq.

date_format
Type: string
Default: lq!%a, %b %d, %Y at %I:%M:%S%p %Zrq
This variable controls the format of the date printed by the lq%drq sequence in lq$index_formatrq. This is passed to the strftime call to process the date. See the man page for strftime(3) for the proper syntax.
Unless the first character in the string is a bang (lq!rq), the month and week day names are expanded according to the locale specified in the variable lq$localerq. If the first character in the string is a bang, the bang is discarded, and the month and week day names in the rest of the string are expanded in the C locale (that is in US English).

default_hook
Type: string
Default: lq~f %s !~P | (~P ~C %s)rq
This variable controls how message-hooks, reply-hooks, send-hooks, send2-hooks, save-hooks, and fcc-hooks will be interpreted if they are specified with only a simple regexp, instead of a matching pattern. The hooks are expanded when they are declared, so a hook will be interpreted according to the value of this variable at the time the hook is declared. The default value matches if the message is either from a user matching the regular expression given, or if it is from you (if the from address matches lqalternatesrq) and is to or cc'ed to a user matching the given regular expression.

delete
Type: quadoption
Default: ask-yes
Controls whether or not messages are really deleted when closing or synchronizing a mailbox. If set to yes, messages marked for deleting will automatically be purged without prompting. If set to no, messages marked for deletion will be kept in the mailbox.

delete_untag
Type: boolean
Default: yes
If this option is set, mutt will untag messages when marking them for deletion. This applies when you either explicitly delete a message, or when you save it to another folder.

digest_collapse
Type: boolean
Default: yes
If this option is set, mutt's received-attachments menu will not show the subparts of individual messages in a multipart/digest. To see these subparts, press 'v' on that menu.

display_filter
Type: path
Default: lqrq
When set, specifies a command used to filter messages. When a message is viewed it is passed as standard input to $display_filter, and the filtered message is read from the standard output.

dotlock_program
Type: path
Default: lq/opt/mutt/bin/mutt_dotlockrq
Contains the path of the mutt_dotlock (8) binary to be used by mutt.

dsn_notify
Type: string
Default: lqrq
This variable sets the request for when notification is returned. The string consists of a comma separated list (no spaces!) of one or more of the following: never, to never request notification, failure, to request notification on transmission failure, delay, to be notified of message delays, success, to be notified of successful transmission.
Example: set dsn_notify=rqfailure,delayrq
Note: when using $sendmail for delivery, you should not enable this unless you are either using Sendmail 8.8.x or greater or a MTA providing a sendmail(1)-compatible interface supporting the -N option for DSN. For SMTP delivery, it depends on the server whether DSN is supported or not.

dsn_return
Type: string
Default: lqrq
This variable controls how much of your message is returned in DSN messages. It may be set to either hdrs to return just the message header, or full to return the full message.
Example: set dsn_return=hdrs
Note: when using $sendmail for delivery, you should not enable this unless you are either using Sendmail 8.8.x or greater or a MTA providing a sendmail(1)-compatible interface supporting the -R option for DSN. For SMTP delivery, it depends on the server whether DSN is supported or not.

duplicate_threads
Type: boolean
Default: yes
This variable controls whether mutt, when sorting by threads, threads messages with the same message-id together. If it is set, it will indicate that it thinks they are duplicates of each other with an equals sign in the thread diagram.

edit_headers
Type: boolean
Default: no
This option allows you to edit the header of your outgoing messages along with the body of your message.
Note that changes made to the References: and Date: headers are ignored for interoperability reasons.

editor
Type: path
Default: lqrq
This variable specifies which editor is used by mutt. It defaults to the value of the VISUAL, or EDITOR, environment variable, or to the string rqvirq if neither of those are set.

encode_from
Type: boolean
Default: no
When set, mutt will quoted-printable encode messages when they contain the string rqFrom rq in the beginning of a line. Useful to avoid the tampering certain mail delivery and transport agents tend to do with messages.

envelope_from_address
Type: e-mail address
Default: lqrq
Manually sets the envelope sender for outgoing messages. This value is ignored if lq$use_envelope_fromrq is unset.

escape
Type: string
Default: lq~rq
Escape character to use for functions in the builtin editor.

fast_reply
Type: boolean
Default: no
When set, the initial prompt for recipients and subject are skipped when replying to messages, and the initial prompt for subject is skipped when forwarding messages.
Note: this variable has no effect when the lq$autoeditrq variable is set.

fcc_attach
Type: boolean
Default: yes
This variable controls whether or not attachments on outgoing messages are saved along with the main body of your message.

fcc_clear
Type: boolean
Default: no
When this variable is set, FCCs will be stored unencrypted and unsigned, even when the actual message is encrypted and/or signed. (PGP only)

folder
Type: path
Default: lq~/Mailrq
Specifies the default location of your mailboxes. A `+' or `=' at the beginning of a pathname will be expanded to the value of this variable. Note that if you change this variable from the default value you need to make sure that the assignment occurs before you use `+' or `=' for any other variables since expansion takes place during the `set' command.

folder_format
Type: string
Default: lq%2C %t %N %F %2l %-8.8u %-8.8g %8s %d %frq
This variable allows you to customize the file browser display to your personal taste. This string is similar to lq$index_formatrq, but has its own set of printf()-like sequences:
%C
current file number
%d
date/time folder was last modified
%f
filename
%F
file permissions
%g
group name (or numeric gid, if missing)
%l
number of hard links
%N
N if folder has new mail, blank otherwise
%s
size in bytes
%t
* if the file is tagged, blank otherwise
%u
owner name (or numeric uid, if missing)
%>X
right justify the rest of the string and pad with character rqXrq
%|X
pad to the end of the line with character rqXrq
%*X
soft-fill with character rqXrq as pad
For an explanation of `soft-fill', see the lq$index_formatrq documentation.

followup_to
Type: boolean
Default: yes
Controls whether or not the Mail-Followup-To header field is generated when sending mail. When set, Mutt will generate this field when you are replying to a known mailing list, specified with the lqsubscriberq or lqlistsrq commands.
This field has two purposes. First, preventing you from receiving duplicate copies of replies to messages which you send to mailing lists, and second, ensuring that you do get a reply separately for any messages sent to known lists to which you are not subscribed. The header will contain only the list's address for subscribed lists, and both the list address and your own email address for unsubscribed lists. Without this header, a group reply to your message sent to a subscribed list will be sent to both the list and your address, resulting in two copies of the same email for you.

force_name
Type: boolean
Default: no
This variable is similar to lq$save_namerq, except that Mutt will store a copy of your outgoing message by the username of the address you are sending to even if that mailbox does not exist.
Also see the lq$recordrq variable.

forward_decode
Type: boolean
Default: yes
Controls the decoding of complex MIME messages into text/plain when forwarding a message. The message header is also RFC2047 decoded. This variable is only used, if lq$mime_forwardrq is unset, otherwise lq$mime_forward_decoderq is used instead.

forward_edit
Type: quadoption
Default: yes
This quadoption controls whether or not the user is automatically placed in the editor when forwarding messages. For those who always want to forward with no modification, use a setting of lqnorq.

forward_format
Type: string
Default: lq[%a: %s]rq
This variable controls the default subject when forwarding a message. It uses the same format sequences as the lq$index_formatrq variable.

forward_quote
Type: boolean
Default: no
When set forwarded messages included in the main body of the message (when lq$mime_forwardrq is unset) will be quoted using lq$indent_stringrq.

from
Type: e-mail address
Default: lqrq
When set, this variable contains a default from address. It can be overridden using my_hdr (including from send-hooks) and lq$reverse_namerq. This variable is ignored if lq$use_fromrq is unset.
Defaults to the contents of the environment variable EMAIL.

gecos_mask
Type: regular expression
Default: lq^[^,]*rq
A regular expression used by mutt to parse the GECOS field of a password entry when expanding the alias. By default the regular expression is set to rq^[^,]*rq which will return the string up to the first rq,rq encountered. If the GECOS field contains a string like rqlastname, firstnamerq then you should set the gecos_mask=rq.*rq.
This can be useful if you see the following behavior: you address a e-mail to user ID stevef whose full name is Steve Franklin. If mutt expands stevef to rqFranklinrq stevef@foo.bar then you should set the gecos_mask to a regular expression that will match the whole name so mutt will expand rqFranklinrq to rqFranklin, Steverq.

hdrs
Type: boolean
Default: yes
When unset, the header fields normally added by the lqmy_hdrrq command are not created. This variable must be unset before composing a new message or replying in order to take effect. If set, the user defined header fields are added to every new message.

header
Type: boolean
Default: no
When set, this variable causes Mutt to include the header of the message you are replying to into the edit buffer. The lq$weedrq setting applies.

help
Type: boolean
Default: yes
When set, help lines describing the bindings for the major functions provided by each menu are displayed on the first line of the screen.
Note: The binding will not be displayed correctly if the function is bound to a sequence rather than a single keystroke. Also, the help line may not be updated if a binding is changed while Mutt is running. Since this variable is primarily aimed at new users, neither of these should present a major problem.

hidden_host
Type: boolean
Default: no
When set, mutt will skip the host name part of lq$hostnamerq variable when adding the domain part to addresses. This variable does not affect the generation of Message-IDs, and it will not lead to the cut-off of first-level domains.

hide_limited
Type: boolean
Default: no
When set, mutt will not show the presence of messages that are hidden by limiting, in the thread tree.

hide_missing
Type: boolean
Default: yes
When set, mutt will not show the presence of missing messages in the thread tree.

hide_thread_subject
Type: boolean
Default: yes
When set, mutt will not show the subject of messages in the thread tree that have the same subject as their parent or closest previously displayed sibling.

hide_top_limited
Type: boolean
Default: no
When set, mutt will not show the presence of messages that are hidden by limiting, at the top of threads in the thread tree. Note that when $hide_limited is set, this option will have no effect.

hide_top_missing
Type: boolean
Default: yes
When set, mutt will not show the presence of missing messages at the top of threads in the thread tree. Note that when $hide_missing is set, this option will have no effect.

history
Type: number
Default: 10
This variable controls the size (in number of strings remembered) of the string history buffer. The buffer is cleared each time the variable is set.

history_file
Type: path
Default: lq~/.mutthistoryrq
The file in which Mutt will save its history.

honor_followup_to
Type: quadoption
Default: yes
This variable controls whether or not a Mail-Followup-To header is honored when group-replying to a message.

hostname
Type: string
Default: lqrq
Specifies the fully-qualified hostname of the system mutt is running on containing the host's name and the DNS domain it belongs to. It is used as the domain part (after lq@rq) for local email addresses as well as Message-Id headers.
Its value is determined at startup as follows: If the node's name as returned by the uname(3) function contains the hostname and the domain, these are used to construct $hostname. If there is no domain part returned, Mutt will look for a lqdomainrq or lqsearchrq line in /etc/resolv.conf to determine the domain. Optionally, Mutt can be compiled with a fixed domain name in which case a detected one is not used.
Also see lq$use_domainrq and lq$hidden_hostrq.

ignore_linear_white_space
Type: boolean
Default: no
This option replaces linear-white-space between encoded-word and *text to a single space to prevent the display of MIME-encoded lqSubjectrq field from being divided into multiple lines.

ignore_list_reply_to
Type: boolean
Default: no
Affects the behaviour of the reply function when replying to messages from mailing lists (as defined by the lqsubscriberq or lqlistsrq commands). When set, if the lqReply-To:rq field is set to the same value as the lqTo:rq field, Mutt assumes that the lqReply-To:rq field was set by the mailing list to automate responses to the list, and will ignore this field. To direct a response to the mailing list when this option is set, use the list-reply function; group-reply will reply to both the sender and the list.

imap_authenticators
Type: string
Default: lqrq
This is a colon-delimited list of authentication methods mutt may attempt to use to log in to an IMAP server, in the order mutt should try them. Authentication methods are either 'login' or the right side of an IMAP 'AUTH=xxx' capability string, eg 'digest-md5', 'gssapi' or 'cram-md5'. This parameter is case-insensitive. If this parameter is unset (the default) mutt will try all available methods, in order from most-secure to least-secure.
Example: set imap_authenticators=rqgssapi:cram-md5:loginrq
Note: Mutt will only fall back to other authentication methods if the previous methods are unavailable. If a method is available but authentication fails, mutt will not connect to the IMAP server.

imap_check_subscribed
Type: boolean
Default: no
When set, mutt will fetch the set of subscribed folders from your server on connection, and add them to the set of mailboxes it polls for new mail. See also the lqmailboxesrq command.

imap_delim_chars
Type: string
Default: lq/.rq
This contains the list of characters which you would like to treat as folder separators for displaying IMAP paths. In particular it helps in using the '=' shortcut for your folder variable.

imap_headers
Type: string
Default: lqrq
Mutt requests these header fields in addition to the default headers (rqDATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES X-LABELrq) from IMAP servers before displaying the index menu. You may want to add more headers for spam detection. Note: This is a space separated list.

imap_idle
Type: boolean
Default: no
When set, mutt will attempt to use the IMAP IDLE extension to check for new mail in the current mailbox. Some servers (dovecot was the inspiration for this option) react badly to mutt's implementation. If your connection seems to freeze up periodically, try unsetting this.

imap_keepalive
Type: number
Default: 900
This variable specifies the maximum amount of time in seconds that mutt will wait before polling open IMAP connections, to prevent the server from closing them before mutt has finished with them. The default is well within the RFC-specified minimum amount of time (30 minutes) before a server is allowed to do this, but in practice the RFC does get violated every now and then. Reduce this number if you find yourself getting disconnected from your IMAP server due to inactivity.

imap_list_subscribed
Type: boolean
Default: no
This variable configures whether IMAP folder browsing will look for only subscribed folders or all folders. This can be toggled in the IMAP browser with the toggle-subscribed function.

imap_login
Type: string
Default: lqrq
Your login name on the IMAP server.
This variable defaults to the value of imap_user.

imap_pass
Type: string
Default: lqrq
Specifies the password for your IMAP account. If unset, Mutt will prompt you for your password when you invoke the fetch-mail function. Warning: you should only use this option when you are on a fairly secure machine, because the superuser can read your muttrc even if you are the only one who can read the file.

imap_passive
Type: boolean
Default: yes
When set, mutt will not open new IMAP connections to check for new mail. Mutt will only check for new mail over existing IMAP connections. This is useful if you don't want to be prompted to user/password pairs on mutt invocation, or if opening the connection is slow.

imap_peek
Type: boolean
Default: yes
When set, mutt will avoid implicitly marking your mail as read whenever you fetch a message from the server. This is generally a good thing, but can make closing an IMAP folder somewhat slower. This option exists to appease speed freaks.

imap_servernoise
Type: boolean
Default: yes
When set, mutt will display warning messages from the IMAP server as error messages. Since these messages are often harmless, or generated due to configuration problems on the server which are out of the users' hands, you may wish to suppress them at some point.

imap_user
Type: string
Default: lqrq
The name of the user whose mail you intend to access on the IMAP server.
This variable defaults to your user name on the local machine.

implicit_autoview
Type: boolean
Default: no
If set to lqyesrq, mutt will look for a mailcap entry with the copiousoutput flag set for every MIME attachment it doesn't have an internal viewer defined for. If such an entry is found, mutt will use the viewer defined in that entry to convert the body part to text form.

include
Type: quadoption
Default: ask-yes
Controls whether or not a copy of the message(s) you are replying to is included in your reply.

include_onlyfirst
Type: boolean
Default: no
Controls whether or not Mutt includes only the first attachment of the message you are replying.

indent_string
Type: string
Default: lq> rq
Specifies the string to prepend to each line of text quoted in a message to which you are replying. You are strongly encouraged not to change this value, as it tends to agitate the more fanatical netizens.
This option is a format string, please see the description of lq$index_formatrq for supported printf()-style sequences.

index_format
Type: string
Default: lq%4C %Z %{%b %d} %-15.15L (%?l?%4l&%4c?) %srq
This variable allows you to customize the message index display to your personal taste.
lqFormat stringsrq are similar to the strings used in the lqCrq function printf to format output (see the man page for more detail). The following sequences are defined in Mutt:
%a
address of the author
%A
reply-to address (if present; otherwise: address of author)
%b
filename of the original message folder (think mailBox)
%B
the list to which the letter was sent, or else the folder name (%b).
%c
number of characters (bytes) in the message
%C
current message number
%d
date and time of the message in the format specified by lqdate_formatrq converted to sender's time zone
%D
date and time of the message in the format specified by lqdate_formatrq converted to the local time zone
%e
current message number in thread
%E
number of messages in current thread
%f
sender (address + real name), either From: or Return-Path:
%F
author name, or recipient name if the message is from you
%H
spam attribute(s) of this message
%i
message-id of the current message
%l
number of lines in the message (does not work with maildir, mh, and possibly IMAP folders)
%L
If an address in the To or CC header field matches an address defined by the users lqsubscriberq command, this displays rqTo <list-name>rq, otherwise the same as %F.
%m
total number of message in the mailbox
%M
number of hidden messages if the thread is collapsed.
%N
message score
%n
author's real name (or address if missing)
%O
(_O_riginal save folder) Where mutt would formerly have stashed the message: list name or recipient name if no list
%P
progress indicator for the builtin pager (how much of the file has been displayed)
%s
subject of the message
%S
status of the message (N/D/d/!/r/*)
%t
`to:' field (recipients)
%T
the appropriate character from the $to_chars string
%u
user (login) name of the author
%v
first name of the author, or the recipient if the message is from you
%X
number of attachments (please see the lqattachmentsrq section for possible speed effects)
%y
`x-label:' field, if present
%Y
`x-label' field, if present, and (1) not at part of a thread tree, (2) at the top of a thread, or (3) `x-label' is different from preceding message's `x-label'.
%Z
message status flags
%{fmt}
the date and time of the message is converted to sender's time zone, and lqfmtrq is expanded by the library function lqstrftimerq; a leading bang disables locales
%[fmt]
the date and time of the message is converted to the local time zone, and lqfmtrq is expanded by the library function lqstrftimerq; a leading bang disables locales
%(fmt)
the local date and time when the message was received. lqfmtrq is expanded by the library function lqstrftimerq; a leading bang disables locales
%<fmt>
the current local time. lqfmtrq is expanded by the library function lqstrftimerq; a leading bang disables locales.
%>X
right justify the rest of the string and pad with character rqXrq
%|X
pad to the end of the line with character rqXrq
%*X
soft-fill with character rqXrq as pad
`Soft-fill' deserves some explanation. Normal right-justification will print everything to the left of the %>, displaying padding and the whatever lies to the right only if there's room. By contrast, soft-fill gives priority to the right-hand side, guaranteeing space to display it and showing padding only if there's still room. If necessary, soft-fill will eat text leftwards to make room for rightward text.
Note that these expandos are supported in lqsave-hookrq, lqfcc-hookrq and lqfcc-save-hookrq, too.
See also: lq$to_charsrq.

ispell
Type: path
Default: lq/usr/bin/ispellrq
How to invoke ispell (GNU's spell-checking software).

keep_flagged
Type: boolean
Default: no
If set, read messages marked as flagged will not be moved from your spool mailbox to your lq$mboxrq mailbox, or as a result of a lqmbox-hookrq command.

locale
Type: string
Default: lqCrq
The locale used by strftime(3) to format dates. Legal values are the strings your system accepts for the locale variable LC_TIME.

mail_check
Type: number
Default: 5
This variable configures how often (in seconds) mutt should look for new mail. Also see the lq$timeoutrq variable.

mailcap_path
Type: string
Default: lqrq
This variable specifies which files to consult when attempting to display MIME bodies not directly supported by Mutt.

mailcap_sanitize
Type: boolean
Default: yes
If set, mutt will restrict possible characters in mailcap % expandos to a well-defined set of safe characters. This is the safe setting, but we are not sure it doesn't break some more advanced MIME stuff.
DON'T CHANGE THIS SETTING UNLESS YOU ARE REALLY SURE WHAT YOU ARE DOING!

header_cache
Type: path
Default: lqrq
The header_cache variable points to the header cache database. If header_cache points to a directory it will contain a header cache database per folder. If header_cache points to a file that file will be a single global header cache. By default it is unset so no header caching will be used.

maildir_header_cache_verify
Type: boolean
Default: yes
Check for Maildir unaware programs other than mutt having modified maildir files when the header cache is in use. This incurs one stat(2) per message every time the folder is opened.

header_cache_pagesize
Type: string
Default: lq16384rq
When mutt is compiled with either gdbm or bdb4 as the header cache backend, this option changes the database page size. Too large or too small values can waste space, memory, or CPU time. The default should be more or less optimal for most use cases.

header_cache_compress
Type: boolean
Default: yes
When mutt is compiled with qdbm as header cache backend, this option determines whether the database will be compressed. Compression results in database files roughly being one fifth of the usual diskspace, but the uncompression can result in a slower opening of cached folder(s).

maildir_trash
Type: boolean
Default: no
If set, messages marked as deleted will be saved with the maildir (T)rashed flag instead of unlinked. NOTE: this only applies to maildir-style mailboxes. Setting it will have no effect on other mailbox types.

mark_old
Type: boolean
Default: yes
Controls whether or not mutt marks new unread messages as old if you exit a mailbox without reading them. With this option set, the next time you start mutt, the messages will show up with an rqOrq next to them in the index menu, indicating that they are old.

markers
Type: boolean
Default: yes
Controls the display of wrapped lines in the internal pager. If set, a lq+rq marker is displayed at the beginning of wrapped lines. Also see the lq$smart_wraprq variable.

mask
Type: regular expression
Default: lq!^\.[^.]rq
A regular expression used in the file browser, optionally preceded by the not operator lq!rq. Only files whose names match this mask will be shown. The match is always case-sensitive.

mbox
Type: path
Default: lq~/mboxrq
This specifies the folder into which read mail in your lq$spoolfilerq folder will be appended.

mbox_type
Type: folder magic
Default: mbox
The default mailbox type used when creating new folders. May be any of mbox, MMDF, MH and Maildir.

metoo
Type: boolean
Default: no
If unset, Mutt will remove your address (see the lqalternatesrq command) from the list of recipients when replying to a message.

menu_context
Type: number
Default: 0
This variable controls the number of lines of context that are given when scrolling through menus. (Similar to lq$pager_contextrq.)

menu_move_off
Type: boolean
Default: yes
When unset, the bottom entry of menus will never scroll up past the bottom of the screen, unless there are less entries than lines. When set, the bottom entry may move off the bottom.

menu_scroll
Type: boolean
Default: no
When set, menus will be scrolled up or down one line when you attempt to move across a screen boundary. If unset, the screen is cleared and the next or previous page of the menu is displayed (useful for slow links to avoid many redraws).

meta_key
Type: boolean
Default: no
If set, forces Mutt to interpret keystrokes with the high bit (bit 8) set as if the user had pressed the ESC key and whatever key remains after having the high bit removed. For example, if the key pressed has an ASCII value of 0xf8, then this is treated as if the user had pressed ESC then lqxrq. This is because the result of removing the high bit from lq0xf8rq is lq0x78rq, which is the ASCII character lqxrq.

mh_purge
Type: boolean
Default: no
When unset, mutt will mimic mh's behaviour and rename deleted messages to ,<old file name> in mh folders instead of really deleting them. If the variable is set, the message files will simply be deleted.

mh_seq_flagged
Type: string
Default: lqflaggedrq
The name of the MH sequence used for flagged messages.

mh_seq_replied
Type: string
Default: lqrepliedrq
The name of the MH sequence used to tag replied messages.

mh_seq_unseen
Type: string
Default: lqunseenrq
The name of the MH sequence used for unseen messages.

mime_forward
Type: quadoption
Default: no
When set, the message you are forwarding will be attached as a separate MIME part instead of included in the main body of the message. This is useful for forwarding MIME messages so the receiver can properly view the message as it was delivered to you. If you like to switch between MIME and not MIME from mail to mail, set this variable to ask-no or ask-yes.
Also see lq$forward_decoderq and lq$mime_forward_decoderq.

mime_forward_decode
Type: boolean
Default: no
Controls the decoding of complex MIME messages into text/plain when forwarding a message while lq$mime_forwardrq is set. Otherwise lq$forward_decoderq is used instead.

mime_forward_rest
Type: quadoption
Default: yes
When forwarding multiple attachments of a MIME message from the recvattach menu, attachments which cannot be decoded in a reasonable manner will be attached to the newly composed message if this option is set.

mix_entry_format
Type: string
Default: lq%4n %c %-16s %arq
This variable describes the format of a remailer line on the mixmaster chain selection screen. The following printf-like sequences are supported:
%n
The running number on the menu.
%c
Remailer capabilities.
%s
The remailer's short name.
%a
The remailer's e-mail address.

mixmaster
Type: path
Default: lqmixmasterrq
This variable contains the path to the Mixmaster binary on your system. It is used with various sets of parameters to gather the list of known remailers, and to finally send a message through the mixmaster chain.

move
Type: quadoption
Default: ask-no
Controls whether or not Mutt will move read messages from your spool mailbox to your lq$mboxrq mailbox, or as a result of a lqmbox-hookrq command.

message_cachedir
Type: path
Default: lqrq
Set this to a directory and mutt will cache copies of messages from your IMAP and POP servers here. You are free to remove entries at any time, for instance if stale entries accumulate because you have deleted messages with another mail client.

message_cache_clean
Type: boolean
Default: no
If set, mutt will clean out obsolete entries from the cache when the mailbox is synchronized. You probably only want to set it every once in a while, since it can be a little slow.

message_format
Type: string
Default: lq%srq
This is the string displayed in the lqattachmentrq menu for attachments of type message/rfc822. For a full listing of defined printf()-like sequences see the section on lq$index_formatrq.

narrow_tree
Type: boolean
Default: no
This variable, when set, makes the thread tree narrower, allowing deeper threads to fit on the screen.

net_inc
Type: number
Default: 10
Operations that expect to transfer a large amount of data over the network will update their progress every net_inc kilobytes. If set to 0, no progress messages will be displayed.
See also lq$read_incrq and lq$write_incrq.

pager
Type: path
Default: lqbuiltinrq
This variable specifies which pager you would like to use to view messages. builtin means to use the builtin pager, otherwise this variable should specify the pathname of the external pager you would like to use.
Using an external pager may have some disadvantages: Additional keystrokes are necessary because you can't call mutt functions directly from the pager, and screen resizes cause lines longer than the screen width to be badly formatted in the help menu.

pager_context
Type: number
Default: 0
This variable controls the number of lines of context that are given when displaying the next or previous page in the internal pager. By default, Mutt will display the line after the last one on the screen at the top of the next page (0 lines of context).

pager_format
Type: string
Default: lq-%Z- %C/%m: %-20.20n   %s%*  -- (%P)rq
This variable controls the format of the one-line message lqstatusrq displayed before each message in either the internal or an external pager. The valid sequences are listed in the lq$index_formatrq section.

pager_index_lines
Type: number
Default: 0
Determines the number of lines of a mini-index which is shown when in the pager. The current message, unless near the top or bottom of the folder, will be roughly one third of the way down this mini-index, giving the reader the context of a few messages before and after the message. This is useful, for example, to determine how many messages remain to be read in the current thread. One of the lines is reserved for the status bar from the index, so a pager_index_lines of 6 will only show 5 lines of the actual index. A value of 0 results in no index being shown. If the number of messages in the current folder is less than pager_index_lines, then the index will only use as many lines as it needs.

pager_stop
Type: boolean
Default: no
When set, the internal-pager will not move to the next message when you are at the end of a message and invoke the next-page function.

crypt_autosign
Type: boolean
Default: no
Setting this variable will cause Mutt to always attempt to cryptographically sign outgoing messages. This can be overridden by use of the pgp-menu, when signing is not required or encryption is requested as well. If lq$smime_is_defaultrq is set, then OpenSSL is used instead to create S/MIME messages and settings can be overridden by use of the smime-menu. (Crypto only)

crypt_autoencrypt
Type: boolean
Default: no
Setting this variable will cause Mutt to always attempt to PGP encrypt outgoing messages. This is probably only useful in connection to the send-hook command. It can be overridden by use of the pgp-menu, when encryption is not required or signing is requested as well. IF lq$smime_is_defaultrq is set, then OpenSSL is used instead to create S/MIME messages and settings can be overridden by use of the smime-menu. (Crypto only)

pgp_ignore_subkeys
Type: boolean
Default: yes
Setting this variable will cause Mutt to ignore OpenPGP subkeys. Instead, the principal key will inherit the subkeys' capabilities. Unset this if you want to play interesting key selection games. (PGP only)

crypt_replyencrypt
Type: boolean
Default: yes
If set, automatically PGP or OpenSSL encrypt replies to messages which are encrypted. (Crypto only)

crypt_replysign
Type: boolean
Default: no
If set, automatically PGP or OpenSSL sign replies to messages which are signed.
Note: this does not work on messages that are encrypted and signed! (Crypto only)

crypt_replysignencrypted
Type: boolean
Default: no
If set, automatically PGP or OpenSSL sign replies to messages which are encrypted. This makes sense in combination with lq$crypt_replyencryptrq, because it allows you to sign all messages which are automatically encrypted. This works around the problem noted in lq$crypt_replysignrq, that mutt is not able to find out whether an encrypted message is also signed. (Crypto only)

crypt_timestamp
Type: boolean
Default: yes
If set, mutt will include a time stamp in the lines surrounding PGP or S/MIME output, so spoofing such lines is more difficult. If you are using colors to mark these lines, and rely on these, you may unset this setting. (Crypto only)

pgp_use_gpg_agent
Type: boolean
Default: no
If set, mutt will use a possibly-running gpg-agent process. (PGP only)

crypt_verify_sig
Type: quadoption
Default: yes
If lqyesrq, always attempt to verify PGP or S/MIME signatures. If lqaskrq, ask whether or not to verify the signature. If lqnorq, never attempt to verify cryptographic signatures. (Crypto only)

smime_is_default
Type: boolean
Default: no
The default behaviour of mutt is to use PGP on all auto-sign/encryption operations. To override and to use OpenSSL instead this must be set. However, this has no effect while replying, since mutt will automatically select the same application that was used to sign/encrypt the original message. (Note that this variable can be overridden by unsetting $crypt_autosmime.) (S/MIME only)

smime_ask_cert_label
Type: boolean
Default: yes
This flag controls whether you want to be asked to enter a label for a certificate about to be added to the database or not. It is set by default. (S/MIME only)

smime_decrypt_use_default_key
Type: boolean
Default: yes
If set (default) this tells mutt to use the default key for decryption. Otherwise, if manage multiple certificate-key-pairs, mutt will try to use the mailbox-address to determine the key to use. It will ask you to supply a key, if it can't find one. (S/MIME only)

pgp_entry_format
Type: string
Default: lq%4n %t%f %4l/0x%k %-4a %2c %urq
This variable allows you to customize the PGP key selection menu to your personal taste. This string is similar to lq$index_formatrq, but has its own set of printf()-like sequences:
%n
number
%k
key id
%u
user id
%a
algorithm
%l
key length
%f
flags
%c
capabilities
%t
trust/validity of the key-uid association
%[<s>]
date of the key where <s> is an strftime(3) expression
(PGP only)

pgp_good_sign
Type: regular expression
Default: lqrq
If you assign a text to this variable, then a PGP signature is only considered verified if the output from $pgp_verify_command contains the text. Use this variable if the exit code from the command is 0 even for bad signatures. (PGP only)

pgp_check_exit
Type: boolean
Default: yes
If set, mutt will check the exit code of the PGP subprocess when signing or encrypting. A non-zero exit code means that the subprocess failed. (PGP only)

pgp_long_ids
Type: boolean
Default: no
If set, use 64 bit PGP key IDs. Unset uses the normal 32 bit Key IDs. (PGP only)

pgp_retainable_sigs
Type: boolean
Default: no
If set, signed and encrypted messages will consist of nested multipart/signed and multipart/encrypted body parts.
This is useful for applications like encrypted and signed mailing lists, where the outer layer (multipart/encrypted) can be easily removed, while the inner multipart/signed part is retained. (PGP only)

pgp_autoinline
Type: boolean
Default: no
This option controls whether Mutt generates old-style inline (traditional) PGP encrypted or signed messages under certain circumstances. This can be overridden by use of the pgp-menu, when inline is not required.
Note that Mutt might automatically use PGP/MIME for messages which consist of more than a single MIME part. Mutt can be configured to ask before sending PGP/MIME messages when inline (traditional) would not work. See also: lq$pgp_mime_autorq.
Also note that using the old-style PGP message format is strongly deprecated. (PGP only)

pgp_replyinline
Type: boolean
Default: no
Setting this variable will cause Mutt to always attempt to create an inline (traditional) message when replying to a message which is PGP encrypted/signed inline. This can be overridden by use of the pgp-menu, when inline is not required. This option does not automatically detect if the (replied-to) message is inline; instead it relies on Mutt internals for previously checked/flagged messages.
Note that Mutt might automatically use PGP/MIME for messages which consist of more than a single MIME part. Mutt can be configured to ask before sending PGP/MIME messages when inline (traditional) would not work. See also: lq$pgp_mime_autorq.
Also note that using the old-style PGP message format is strongly deprecated. (PGP only)

pgp_show_unusable
Type: boolean
Default: yes
If set, mutt will display non-usable keys on the PGP key selection menu. This includes keys which have been revoked, have expired, or have been marked as lqdisabledrq by the user. (PGP only)

pgp_sign_as
Type: string
Default: lqrq
If you have more than one key pair, this option allows you to specify which of your private keys to use. It is recommended that you use the keyid form to specify your key (e.g., lq0x00112233rq). (PGP only)

pgp_strict_enc
Type: boolean
Default: yes
If set, Mutt will automatically encode PGP/MIME signed messages as quoted-printable. Please note that unsetting this variable may lead to problems with non-verifyable PGP signatures, so only change this if you know what you are doing. (PGP only)

pgp_timeout
Type: number
Default: 300
The number of seconds after which a cached passphrase will expire if not used. (PGP only)

pgp_sort_keys
Type: sort order
Default: address
Specifies how the entries in the `pgp keys' menu are sorted. The following are legal values:
address
sort alphabetically by user id
keyid
sort alphabetically by key id
date
sort by key creation date
trust
sort by the trust of the key
If you prefer reverse order of the above values, prefix it with `reverse-'. (PGP only)

pgp_mime_auto
Type: quadoption
Default: ask-yes
This option controls whether Mutt will prompt you for automatically sending a (signed/encrypted) message using PGP/MIME when inline (traditional) fails (for any reason).
Also note that using the old-style PGP message format is strongly deprecated. (PGP only)

pgp_auto_decode
Type: boolean
Default: no
If set, mutt will automatically attempt to decrypt traditional PGP messages whenever the user performs an operation which ordinarily would result in the contents of the message being operated on. For example, if the user displays a pgp-traditional message which has not been manually checked with the check-traditional-pgp function, mutt will automatically check the message for traditional pgp.

pgp_decode_command
Type: string
Default: lqrq
This format strings specifies a command which is used to decode application/pgp attachments.
The PGP command formats have their own set of printf-like sequences:
%p
Expands to PGPPASSFD=0 when a pass phrase is needed, to an empty string otherwise. Note: This may be used with a %? construct.
%f
Expands to the name of a file containing a message.
%s
Expands to the name of a file containing the signature part
           of a multipart/signed attachment when verifying it.
%a
The value of $pgp_sign_as.
%r
One or more key IDs.
For examples on how to configure these formats for the various versions of PGP which are floating around, see the pgp*.rc and gpg.rc files in the samples/ subdirectory which has been installed on your system alongside the documentation. (PGP only)

pgp_getkeys_command
Type: string
Default: lqrq
This command is invoked whenever mutt will need public key information. %r is the only printf-like sequence used with this format. (PGP only)

pgp_verify_command
Type: string
Default: lqrq
This command is used to verify PGP signatures. (PGP only)

pgp_decrypt_command
Type: string
Default: lqrq
This command is used to decrypt a PGP encrypted message. (PGP only)

pgp_clearsign_command
Type: string
Default: lqrq
This format is used to create a old-style rqclearsignedrq PGP message. Note that the use of this format is strongly deprecated. (PGP only)

pgp_sign_command
Type: string
Default: lqrq
This command is used to create the detached PGP signature for a multipart/signed PGP/MIME body part. (PGP only)

pgp_encrypt_sign_command
Type: string
Default: lqrq
This command is used to both sign and encrypt a body part. (PGP only)

pgp_encrypt_only_command
Type: string
Default: lqrq
This command is used to encrypt a body part without signing it. (PGP only)

pgp_import_command
Type: string
Default: lqrq
This command is used to import a key from a message into the user's public key ring. (PGP only)

pgp_export_command
Type: string
Default: lqrq
This command is used to export a public key from the user's key ring. (PGP only)

pgp_verify_key_command
Type: string
Default: lqrq
This command is used to verify key information from the key selection menu. (PGP only)

pgp_list_secring_command
Type: string
Default: lqrq
This command is used to list the secret key ring's contents. The output format must be analogous to the one used by gpg --list-keys --with-colons.
This format is also generated by the pgpring utility which comes with mutt. (PGP only)

pgp_list_pubring_command
Type: string
Default: lqrq
This command is used to list the public key ring's contents. The output format must be analogous to the one used by gpg --list-keys --with-colons.
This format is also generated by the pgpring utility which comes with mutt. (PGP only)

forward_decrypt
Type: boolean
Default: yes
Controls the handling of encrypted messages when forwarding a message. When set, the outer layer of encryption is stripped off. This variable is only used if lq$mime_forwardrq is set and lq$mime_forward_decoderq is unset. (PGP only)

smime_timeout
Type: number
Default: 300
The number of seconds after which a cached passphrase will expire if not used. (S/MIME only)

smime_encrypt_with
Type: string
Default: lqrq
This sets the algorithm that should be used for encryption. Valid choices are rqdesrq, rqdes3rq, rqrc2-40rq, rqrc2-64rq, rqrc2-128rq. If unset rq3desrq (TripleDES) is used. (S/MIME only)

smime_keys
Type: path
Default: lqrq
Since there is no pubring/secring as with PGP, mutt has to handle storage ad retrieval of keys/certs by itself. This is very basic right now, and stores keys and certificates in two different directories, both named as the hash-value retrieved from OpenSSL. There is an index file which contains mailbox-address keyid pair, and which can be manually edited. This one points to the location of the private keys. (S/MIME only)

smime_ca_location
Type: path
Default: lqrq
This variable contains the name of either a directory, or a file which contains trusted certificates for use with OpenSSL. (S/MIME only)

smime_certificates
Type: path
Default: lqrq
Since there is no pubring/secring as with PGP, mutt has to handle storage and retrieval of keys by itself. This is very basic right now, and keys and certificates are stored in two different directories, both named as the hash-value retrieved from OpenSSL. There is an index file which contains mailbox-address keyid pairs, and which can be manually edited. This one points to the location of the certificates. (S/MIME only)

smime_decrypt_command
Type: string
Default: lqrq
This format string specifies a command which is used to decrypt application/x-pkcs7-mime attachments.
The OpenSSL command formats have their own set of printf-like sequences similar to PGP's:
%f
Expands to the name of a file containing a message.
%s
Expands to the name of a file containing the signature part
           of a multipart/signed attachment when verifying it.
%k
The key-pair specified with $smime_default_key
%c
One or more certificate IDs.
%a
The algorithm used for encryption.
%C
CA location: Depending on whether $smime_ca_location
           points to a directory or file, this expands to 
           rq-CApath $smime_ca_locationrq or rq-CAfile $smime_ca_locationrq.
For examples on how to configure these formats, see the smime.rc in the samples/ subdirectory which has been installed on your system alongside the documentation. (S/MIME only)

smime_verify_command
Type: string
Default: lqrq
This command is used to verify S/MIME signatures of type multipart/signed. (S/MIME only)

smime_verify_opaque_command
Type: string
Default: lqrq
This command is used to verify S/MIME signatures of type application/x-pkcs7-mime. (S/MIME only)

smime_sign_command
Type: string
Default: lqrq
This command is used to created S/MIME signatures of type multipart/signed, which can be read by all mail clients. (S/MIME only)

smime_sign_opaque_command
Type: string
Default: lqrq
This command is used to created S/MIME signatures of type application/x-pkcs7-signature, which can only be handled by mail clients supporting the S/MIME extension. (S/MIME only)

smime_encrypt_command
Type: string
Default: lqrq
This command is used to create encrypted S/MIME messages. (S/MIME only)

smime_pk7out_command
Type: string
Default: lqrq
This command is used to extract PKCS7 structures of S/MIME signatures, in order to extract the public X509 certificate(s). (S/MIME only)

smime_get_cert_command
Type: string
Default: lqrq
This command is used to extract X509 certificates from a PKCS7 structure. (S/MIME only)

smime_get_signer_cert_command
Type: string
Default: lqrq
This command is used to extract only the signers X509 certificate from a S/MIME signature, so that the certificate's owner may get compared to the email's 'From'-field. (S/MIME only)

smime_import_cert_command
Type: string
Default: lqrq
This command is used to import a certificate via smime_keys. (S/MIME only)

smime_get_cert_email_command
Type: string
Default: lqrq
This command is used to extract the mail address(es) used for storing X509 certificates, and for verification purposes (to check whether the certificate was issued for the sender's mailbox). (S/MIME only)

smime_default_key
Type: string
Default: lqrq
This is the default key-pair to use for signing. This must be set to the keyid (the hash-value that OpenSSL generates) to work properly (S/MIME only)

ssl_client_cert
Type: path
Default: lqrq
The file containing a client certificate and its associated private key.

ssl_force_tls
Type: boolean
Default: no
If this variable is set, Mutt will require that all connections to remote servers be encrypted. Furthermore it will attempt to negotiate TLS even if the server does not advertise the capability, since it would otherwise have to abort the connection anyway. This option supersedes lq$ssl_starttlsrq.

ssl_starttls
Type: quadoption
Default: yes
If set (the default), mutt will attempt to use STARTTLS on servers advertising the capability. When unset, mutt will not attempt to use STARTTLS regardless of the server's capabilities.

certificate_file
Type: path
Default: lq~/.mutt_certificatesrq
This variable specifies the file where the certificates you trust are saved. When an unknown certificate is encountered, you are asked if you accept it or not. If you accept it, the certificate can also be saved in this file and further connections are automatically accepted.
You can also manually add CA certificates in this file. Any server certificate that is signed with one of these CA certificates are also automatically accepted.
Example: set certificate_file=~/.mutt/certificates

ssl_usesystemcerts
Type: boolean
Default: yes
If set to yes, mutt will use CA certificates in the system-wide certificate store when checking if server certificate is signed by a trusted CA.

entropy_file
Type: path
Default: lqrq
The file which includes random data that is used to initialize SSL library functions.

ssl_use_sslv2
Type: boolean
Default: yes
This variables specifies whether to attempt to use SSLv2 in the SSL authentication process.

ssl_use_sslv3
Type: boolean
Default: yes
This variables specifies whether to attempt to use SSLv3 in the SSL authentication process.

ssl_use_tlsv1
Type: boolean
Default: yes
This variables specifies whether to attempt to use TLSv1 in the SSL authentication process.

ssl_min_dh_prime_bits
Type: number
Default: 0
This variable specifies the minimum acceptable prime size (in bits) for use in any Diffie-Hellman key exchange. A value of 0 will use the default from the GNUTLS library.

ssl_ca_certificates_file
Type: path
Default: lqrq
This variable specifies a file containing trusted CA certificates. Any server certificate that is signed with one of these CA certificates are also automatically accepted.
Example: set ssl_ca_certificates_file=/etc/ssl/certs/ca-certificates.crt

pipe_split
Type: boolean
Default: no
Used in connection with the pipe-message command and the lqtag- prefixrq operator. If this variable is unset, when piping a list of tagged messages Mutt will concatenate the messages and will pipe them as a single folder. When set, Mutt will pipe the messages one by one. In both cases the messages are piped in the current sorted order, and the lq$pipe_seprq separator is added after each message.

pipe_decode
Type: boolean
Default: no
Used in connection with the pipe-message command. When unset, Mutt will pipe the messages without any preprocessing. When set, Mutt will weed headers and will attempt to PGP/MIME decode the messages first.

pipe_sep
Type: string
Default: lq\nrq
The separator to add between messages when piping a list of tagged messages to an external Unix command.

pop_authenticators
Type: string
Default: lqrq
This is a colon-delimited list of authentication methods mutt may attempt to use to log in to an POP server, in the order mutt should try them. Authentication methods are either 'user', 'apop' or any SASL mechanism, eg 'digest-md5', 'gssapi' or 'cram-md5'. This parameter is case-insensitive. If this parameter is unset (the default) mutt will try all available methods, in order from most-secure to least-secure.
Example: set pop_authenticators=rqdigest-md5:apop:userrq

pop_auth_try_all
Type: boolean
Default: yes
If set, Mutt will try all available methods. When unset, Mutt will only fall back to other authentication methods if the previous methods are unavailable. If a method is available but authentication fails, Mutt will not connect to the POP server.

pop_checkinterval
Type: number
Default: 60
This variable configures how often (in seconds) mutt should look for new mail in the currently selected mailbox if it is a POP mailbox.

pop_delete
Type: quadoption
Default: ask-no
If set, Mutt will delete successfully downloaded messages from the POP server when using the fetch-mail function. When unset, Mutt will download messages but also leave them on the POP server.

pop_host
Type: string
Default: lqrq
The name of your POP server for the fetch-mail function. You can also specify an alternative port, username and password, ie:
[pop[s]://][username[:password]@]popserver[:port]

pop_last
Type: boolean
Default: no
If this variable is set, mutt will try to use the rqLASTrq POP command for retrieving only unread messages from the POP server when using the fetch-mail function.

pop_reconnect
Type: quadoption
Default: ask-yes
Controls whether or not Mutt will try to reconnect to POP server if the connection is lost.

pop_user
Type: string
Default: lqrq
Your login name on the POP server.
This variable defaults to your user name on the local machine.

pop_pass
Type: string
Default: lqrq
Specifies the password for your POP account. If unset, Mutt will prompt you for your password when you open POP mailbox. Warning: you should only use this option when you are on a fairly secure machine, because the superuser can read your muttrc even if you are the only one who can read the file.

post_indent_string
Type: string
Default: lqrq
Similar to the lq$attributionrq variable, Mutt will append this string after the inclusion of a message which is being replied to.

postpone
Type: quadoption
Default: ask-yes
Controls whether or not messages are saved in the lq$postponedrq mailbox when you elect not to send immediately. Also see the lq$recallrq variable.

postponed
Type: path
Default: lq~/postponedrq
Mutt allows you to indefinitely lqpostpone sending a messagerq which you are editing. When you choose to postpone a message, Mutt saves it in the mailbox specified by this variable. Also see the lq$postponerq variable.

preconnect
Type: string
Default: lqrq
If set, a shell command to be executed if mutt fails to establish a connection to the server. This is useful for setting up secure connections, e.g. with ssh(1). If the command returns a nonzero status, mutt gives up opening the server. Example:
preconnect=rqssh -f -q -L 1234:mailhost.net:143 mailhost.net sleep 20 < /dev/null > /dev/nullrq
Mailbox 'foo' on mailhost.net can now be reached as '{localhost:1234}foo'.
NOTE: For this example to work, you must be able to log in to the remote machine without having to enter a password.

print
Type: quadoption
Default: ask-no
Controls whether or not Mutt really prints messages. This is set to ask-no by default, because some people accidentally hit lqprq often (like me).

print_command
Type: path
Default: lqlprrq
This specifies the command pipe that should be used to print messages.

print_decode
Type: boolean
Default: yes
Used in connection with the print-message command. If this option is set, the message is decoded before it is passed to the external command specified by $print_command. If this option is unset, no processing will be applied to the message when printing it. The latter setting may be useful if you are using some advanced printer filter which is able to properly format e-mail messages for printing.

print_split
Type: boolean
Default: no
Used in connection with the print-message command. If this option is set, the command specified by $print_command is executed once for each message which is to be printed. If this option is unset, the command specified by $print_command is executed only once, and all the messages are concatenated, with a form feed as the message separator.
Those who use the enscript(1) program's mail-printing mode will most likely want to set this option.

prompt_after
Type: boolean
Default: yes
If you use an external lq$pagerrq, setting this variable will cause Mutt to prompt you for a command when the pager exits rather than returning to the index menu. If unset, Mutt will return to the index menu when the external pager exits.

query_command
Type: path
Default: lqrq
This specifies the command that mutt will use to make external address queries. The string should contain a %s, which will be substituted with the query string the user types. See lqqueryrq for more information.

query_format
Type: string
Default: lq%4c %t %-25.25a %-25.25n %?e?(%e)?rq
This variable describes the format of the `query' menu. The following printf-style sequences are understood:
%a
destination address
%c
current entry number
%e
extra information *
%n
destination name
%t
lq*rq if current entry is tagged, a space otherwise
%>X
right justify the rest of the string and pad with rqXrq
%|X
pad to the end of the line with rqXrq
%*X
soft-fill with character rqXrq as pad
For an explanation of `soft-fill', see the lq$index_formatrq documentation.
* = can be optionally printed if nonzero, see the lq$status_formatrq documentation.

quit
Type: quadoption
Default: yes
This variable controls whether lqquitrq and lqexitrq actually quit from mutt. If it set to yes, they do quit, if it is set to no, they have no effect, and if it is set to ask-yes or ask-no, you are prompted for confirmation when you try to quit.

quote_regexp
Type: regular expression
Default: lq^([ \t]*[|>:}#])+rq
A regular expression used in the internal-pager to determine quoted sections of text in the body of a message.
Note: In order to use the quotedx patterns in the internal pager, you need to set this to a regular expression that matches exactly the quote characters at the beginning of quoted lines.

read_inc
Type: number
Default: 10
If set to a value greater than 0, Mutt will display which message it is currently on when reading a mailbox or when performing search actions such as search and limit. The message is printed after read_inc messages have been read or searched (e.g., if set to 25, Mutt will print a message when it is at message 25, and then again when it gets to message 50). This variable is meant to indicate progress when reading or searching large mailboxes which may take some time. When set to 0, only a single message will appear before the reading the mailbox.
Also see the lq$write_incrq variable and the lqTuningrq section of the manual for performance considerations.

read_only
Type: boolean
Default: no
If set, all folders are opened in read-only mode.

realname
Type: string
Default: lqrq
This variable specifies what rqrealrq or rqpersonalrq name should be used when sending messages.
By default, this is the GECOS field from /etc/passwd. Note that this variable will not be used when the user has set a real name in the $from variable.

recall
Type: quadoption
Default: ask-yes
Controls whether or not Mutt recalls postponed messages when composing a new message. Also see lq$postponedrq.
Setting this variable to lqyesrq is not generally useful, and thus not recommended.

record
Type: path
Default: lq~/sentrq
This specifies the file into which your outgoing messages should be appended. (This is meant as the primary method for saving a copy of your messages, but another way to do this is using the lqmy_hdrrq command to create a Bcc: field with your email address in it.)
The value of $record is overridden by the lq$force_namerq and lq$save_namerq variables, and the lqfcc-hookrq command.

reply_regexp
Type: regular expression
Default: lq^(re([\[0-9\]+])*|aw):[ \t]*rq
A regular expression used to recognize reply messages when threading and replying. The default value corresponds to the English rqRe:rq and the German rqAw:rq.

reply_self
Type: boolean
Default: no
If unset and you are replying to a message sent by you, Mutt will assume that you want to reply to the recipients of that message rather than to yourself.

reply_to
Type: quadoption
Default: ask-yes
If set, when replying to a message, Mutt will use the address listed in the Reply-to: header as the recipient of the reply. If unset, it will use the address in the From: header field instead. This option is useful for reading a mailing list that sets the Reply-To: header field to the list address and you want to send a private message to the author of a message.

resolve
Type: boolean
Default: yes
When set, the cursor will be automatically advanced to the next (possibly undeleted) message whenever a command that modifies the current message is executed.

reverse_alias
Type: boolean
Default: no
This variable controls whether or not Mutt will display the rqpersonalrq name from your aliases in the index menu if it finds an alias that matches the message's sender. For example, if you have the following alias:

alias juser abd30425@somewhere.net (Joe User)

and then you receive mail which contains the following header:

From: abd30425@somewhere.net

It would be displayed in the index menu as lqJoe Userrq instead of lqabd30425@somewhere.net.rq This is useful when the person's e-mail address is not human friendly (like CompuServe addresses).

reverse_name
Type: boolean
Default: no
It may sometimes arrive that you receive mail to a certain machine, move the messages to another machine, and reply to some the messages from there. If this variable is set, the default From: line of the reply messages is built using the address where you received the messages you are replying to if that address matches your alternates. If the variable is unset, or the address that would be used doesn't match your alternates, the From: line will use your address on the current machine.

reverse_realname
Type: boolean
Default: yes
This variable fine-tunes the behaviour of the reverse_name feature. When it is set, mutt will use the address from incoming messages as-is, possibly including eventual real names. When it is unset, mutt will override any such real names with the setting of the realname variable.

rfc2047_parameters
Type: boolean
Default: no
When this variable is set, Mutt will decode RFC-2047-encoded MIME parameters. You want to set this variable when mutt suggests you to save attachments to files named like this: =?iso-8859-1?Q?file=5F=E4=5F991116=2Ezip?=
When this variable is set interactively, the change doesn't have the desired effect before you have changed folders.
Note that this use of RFC 2047's encoding is explicitly, prohibited by the standard, but nevertheless encountered in the wild. Also note that setting this parameter will not have the effect that mutt generates this kind of encoding. Instead, mutt will unconditionally use the encoding specified in RFC 2231.

save_address
Type: boolean
Default: no
If set, mutt will take the sender's full address when choosing a default folder for saving a mail. If lq$save_namerq or lq$force_namerq is set too, the selection of the fcc folder will be changed as well.

save_empty
Type: boolean
Default: yes
When unset, mailboxes which contain no saved messages will be removed when closed (the exception is lq$spoolfilerq which is never removed). If set, mailboxes are never removed.
Note: This only applies to mbox and MMDF folders, Mutt does not delete MH and Maildir directories.

save_history
Type: number
Default: 0
This variable controls the size of the history saved in the lq$history_filerq file.

save_name
Type: boolean
Default: no
This variable controls how copies of outgoing messages are saved. When set, a check is made to see if a mailbox specified by the recipient address exists (this is done by searching for a mailbox in the lq$folderrq directory with the username part of the recipient address). If the mailbox exists, the outgoing message will be saved to that mailbox, otherwise the message is saved to the lq$recordrq mailbox.
Also see the lq$force_namerq variable.

score
Type: boolean
Default: yes
When this variable is unset, scoring is turned off. This can be useful to selectively disable scoring for certain folders when the lq$score_threshold_deleterq variable and friends are used.

score_threshold_delete
Type: number
Default: -1
Messages which have been assigned a score equal to or lower than the value of this variable are automatically marked for deletion by mutt. Since mutt scores are always greater than or equal to zero, the default setting of this variable will never mark a message for deletion.

score_threshold_flag
Type: number
Default: 9999
Messages which have been assigned a score greater than or equal to this variable's value are automatically marked rqflaggedrq.

score_threshold_read
Type: number
Default: -1
Messages which have been assigned a score equal to or lower than the value of this variable are automatically marked as read by mutt. Since mutt scores are always greater than or equal to zero, the default setting of this variable will never mark a message read.

send_charset
Type: string
Default: lqus-ascii:iso-8859-1:utf-8rq
A colon-delimited list of character sets for outgoing messages. Mutt will use the first character set into which the text can be converted exactly. If your lq$charsetrq is not iso-8859-1 and recipients may not understand UTF-8, it is advisable to include in the list an appropriate widely used standard character set (such as iso-8859-2, koi8-r or iso-2022-jp) either instead of or after rqiso-8859-1rq.
In case the text cannot be converted into one of these exactly, mutt uses lq$charsetrq as a fallback.

sendmail
Type: path
Default: lq/usr/sbin/sendmail -oem -oirq
Specifies the program and arguments used to deliver mail sent by Mutt. Mutt expects that the specified program interprets additional arguments as recipient addresses.

sendmail_wait
Type: number
Default: 0
Specifies the number of seconds to wait for the lq$sendmailrq process to finish before giving up and putting delivery in the background.
Mutt interprets the value of this variable as follows:
>0
number of seconds to wait for sendmail to finish before continuing
0
wait forever for sendmail to finish
<0
always put sendmail in the background without waiting
Note that if you specify a value other than 0, the output of the child process will be put in a temporary file. If there is some error, you will be informed as to where to find the output.

shell
Type: path
Default: lqrq
Command to use when spawning a subshell. By default, the user's login shell from /etc/passwd is used.

sig_dashes
Type: boolean
Default: yes
If set, a line containing lq-- rq will be inserted before your lq$signaturerq. It is strongly recommended that you not unset this variable unless your lqsignaturerq contains just your name. The reason for this is because many software packages use lq-- \nrq to detect your signature. For example, Mutt has the ability to highlight the signature in a different color in the builtin pager.

sig_on_top
Type: boolean
Default: no
If set, the signature will be included before any quoted or forwarded text. It is strongly recommended that you do not set this variable unless you really know what you are doing, and are prepared to take some heat from netiquette guardians.

signature
Type: path
Default: lq~/.signaturerq
Specifies the filename of your signature, which is appended to all outgoing messages. If the filename ends with a pipe (lq|rq), it is assumed that filename is a shell command and input should be read from its stdout.

simple_search
Type: string
Default: lq~f %s | ~s %srq
Specifies how Mutt should expand a simple search into a real search pattern. A simple search is one that does not contain any of the ~ operators. See lqpatternsrq for more information on search patterns.
For example, if you simply type joe at a search or limit prompt, Mutt will automatically expand it to the value specified by this variable. For the default value it would be:
~f joe | ~s joe

smart_wrap
Type: boolean
Default: yes
Controls the display of lines longer than the screen width in the internal pager. If set, long lines are wrapped at a word boundary. If unset, lines are simply wrapped at the screen edge. Also see the lq$markersrq variable.

smileys
Type: regular expression
Default: lq(>From )|(:[-^]?[][)(><}{|/DP])rq
The pager uses this variable to catch some common false positives of lq$quote_regexprq, most notably smileys in the beginning of a line

sleep_time
Type: number
Default: 1
Specifies time, in seconds, to pause while displaying certain informational messages, while moving from folder to folder and after expunging messages from the current folder. The default is to pause one second, so a value of zero for this option suppresses the pause.

smtp_authenticators
Type: string
Default: lqrq
This is a colon-delimited list of authentication methods mutt may attempt to use to log in to an SMTP server, in the order mutt should try them. Authentication methods are any SASL mechanism, eg lqdigest-md5rq, lqgssapirq or lqcram-md5rq. This parameter is case-insensitive. If this parameter is unset (the default) mutt will try all available methods, in order from most-secure to least-secure.
Example: set smtp_authenticators=rqdigest-md5:cram-md5rq

smtp_pass
Type: string
Default: lqrq
Specifies the password for your SMTP account. If unset, Mutt will prompt you for your password when you first send mail via SMTP. See lqsmtp_urlrq to configure mutt to send mail via SMTP. Warning: you should only use this option when you are on a fairly secure machine, because the superuser can read your muttrc even if you are the only one who can read the file.

smtp_url
Type: string
Default: lqrq
Defines the SMTP lqsmartrq host where sent messages should relayed for delivery. This should take the form of an SMTP URL, eg:
smtp[s]://[user[:pass]@]host[:port]/
Setting this variable overrides the value of the lq$sendmailrq variable.

sort
Type: sort order
Default: date
Specifies how to sort messages in the index menu. Valid values are:

   date or date-sent
   date-received
   from
   mailbox-order (unsorted)
   score
   size
   spam
   subject
   threads
   to

You may optionally use the reverse- prefix to specify reverse sorting order (example: set sort=reverse-date-sent).

sort_alias
Type: sort order
Default: alias
Specifies how the entries in the `alias' menu are sorted. The following are legal values:

   address (sort alphabetically by email address)
   alias (sort alphabetically by alias name)
   unsorted (leave in order specified in .muttrc)

sort_aux
Type: sort order
Default: date
When sorting by threads, this variable controls how threads are sorted in relation to other threads, and how the branches of the thread trees are sorted. This can be set to any value that lq$sortrq can, except threads (in that case, mutt will just use date-sent). You can also specify the last- prefix in addition to the reverse- prefix, but last- must come after reverse-. The last- prefix causes messages to be sorted against its siblings by which has the last descendant, using the rest of sort_aux as an ordering. For instance, set sort_aux=last- date-received would mean that if a new message is received in a thread, that thread becomes the last one displayed (or the first, if you have set sort=reverse-threads.) Note: For reversed lq$sortrq order $sort_aux is reversed again (which is not the right thing to do, but kept to not break any existing configuration setting).

sort_browser
Type: sort order
Default: alpha
Specifies how to sort entries in the file browser. By default, the entries are sorted alphabetically. Valid values:

   alpha (alphabetically)
   date
   size
   unsorted

You may optionally use the reverse- prefix to specify reverse sorting order (example: set sort_browser=reverse-date).

sort_re
Type: boolean
Default: yes
This variable is only useful when sorting by threads with lq$strict_threadsrq unset. In that case, it changes the heuristic mutt uses to thread messages by subject. With sort_re set, mutt will only attach a message as the child of another message by subject if the subject of the child message starts with a substring matching the setting of lq$reply_regexprq. With sort_re unset, mutt will attach the message whether or not this is the case, as long as the non-lq$reply_regexprq parts of both messages are identical.

spam_separator
Type: string
Default: lq,rq
lqspam_separatorrq controls what happens when multiple spam headers are matched: if unset, each successive header will overwrite any previous matches value for the spam label. If set, each successive match will append to the previous, using lqspam_separatorrq as a separator.

spoolfile
Type: path
Default: lqrq
If your spool mailbox is in a non-default place where Mutt cannot find it, you can specify its location with this variable. Mutt will automatically set this variable to the value of the environment variable $MAIL if it is not set.

status_chars
Type: string
Default: lq-*%Arq
Controls the characters used by the rq%rrq indicator in lq$status_formatrq. The first character is used when the mailbox is unchanged. The second is used when the mailbox has been changed, and it needs to be resynchronized. The third is used if the mailbox is in read-only mode, or if the mailbox will not be written when exiting that mailbox (You can toggle whether to write changes to a mailbox with the toggle-write operation, bound by default to rq%rq). The fourth is used to indicate that the current folder has been opened in attach- message mode (Certain operations like composing a new mail, replying, forwarding, etc. are not permitted in this mode).

status_format
Type: string
Default: lq-%r-Mutt: %f [Msgs:%?M?%M/?%m%?n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]---(%s/%S)-%>-(%P)---rq
Controls the format of the status line displayed in the index menu. This string is similar to lq$index_formatrq, but has its own set of printf()-like sequences:
%b
number of mailboxes with new mail *
%d
number of deleted messages *
%f
the full pathname of the current mailbox
%F
number of flagged messages *
%h
local hostname
%l
size (in bytes) of the current mailbox *
%L
size (in bytes) of the messages shown (i.e., which match the current limit) *
%m
the number of messages in the mailbox *
%M
the number of messages shown (i.e., which match the current limit) *
%n
number of new messages in the mailbox *
%o
number of old unread messages *
%p
number of postponed messages *
%P
percentage of the way through the index
%r
modified/read-only/won't-write/attach-message indicator, according to $status_chars
%s
current sorting mode ($sort)
%S
current aux sorting method ($sort_aux)
%t
number of tagged messages *
%u
number of unread messages *
%v
Mutt version string
%V
currently active limit pattern, if any *
%>X
right justify the rest of the string and pad with rqXrq
%|X
pad to the end of the line with rqXrq
%*X
soft-fill with character rqXrq as pad
For an explanation of `soft-fill', see the lq$index_formatrq documentation.
* = can be optionally printed if nonzero
Some of the above sequences can be used to optionally print a string if their value is nonzero. For example, you may only want to see the number of flagged messages if such messages exist, since zero is not particularly meaningful. To optionally print a string based upon one of the above sequences, the following construct is used:
%?<sequence_char>?<optional_string>?
where sequence_char is a character from the table above, and optional_string is the string you would like printed if sequence_char is nonzero. optional_string may contain other sequences as well as normal text, but you may not nest optional strings.
Here is an example illustrating how to optionally print the number of new messages in a mailbox: %?n?%n new messages.?
You can also switch between two strings using the following construct:
%?<sequence_char>?<if_string>&<else_string>?
If the value of sequence_char is non-zero, if_string will be expanded, otherwise else_string will be expanded.
You can force the result of any printf-like sequence to be lowercase by prefixing the sequence character with an underscore (_) sign. For example, if you want to display the local hostname in lowercase, you would use: %_h
If you prefix the sequence character with a colon (:) character, mutt will replace any dots in the expansion by underscores. This might be helpful with IMAP folders that don't like dots in folder names.

status_on_top
Type: boolean
Default: no
Setting this variable causes the lqstatus barrq to be displayed on the first line of the screen rather than near the bottom.

strict_threads
Type: boolean
Default: no
If set, threading will only make use of the lqIn-Reply-Torq and lqReferencesrq fields when you lq$sortrq by message threads. By default, messages with the same subject are grouped together in lqpseudo threads.rq. This may not always be desirable, such as in a personal mailbox where you might have several unrelated messages with the subject lqhirq which will get grouped together. See also lq$sort_rerq for a less drastic way of controlling this behaviour.

suspend
Type: boolean
Default: yes
When unset, mutt won't stop when the user presses the terminal's susp key, usually lqcontrol-Zrq. This is useful if you run mutt inside an xterm using a command like xterm -e mutt.

text_flowed
Type: boolean
Default: no
When set, mutt will generate text/plain; format=flowed attachments. This format is easier to handle for some mailing software, and generally just looks like ordinary text. To actually make use of this format's features, you'll need support in your editor.
Note that $indent_string is ignored when this option is set.

thread_received
Type: boolean
Default: no
When set, mutt uses the date received rather than the date sent to thread messages by subject.

thorough_search
Type: boolean
Default: no
Affects the ~b and ~h search operations described in section lqpatternsrq above. If set, the headers and attachments of messages to be searched are decoded before searching. If unset, messages are searched as they appear in the folder.

tilde
Type: boolean
Default: no
When set, the internal-pager will pad blank lines to the bottom of the screen with a tilde (~).

time_inc
Type: number
Default: 0
Along with lqread_incrq, lqwrite_incrq, and lqnet_incrq, this variable controls the frequency with which progress updates are displayed. It suppresses updates less than lqtime_incrq milliseconds apart. This can improve throughput on systems with slow terminals, or when running mutt on a remote system.

timeout
Type: number
Default: 600
When Mutt is waiting for user input either idleing in menus or in an interactive prompt, Mutt would block until input is present. Depending on the context, this would prevent certain operations from working, like checking for new mail or keeping an IMAP connection alive.
This variable controls how many seconds Mutt will at most wait until it aborts waiting for input, performs these operations and continues to wait for input.
A value of zero or less will cause Mutt to never time out.

tmpdir
Type: path
Default: lqrq
This variable allows you to specify where Mutt will place its temporary files needed for displaying and composing messages. If this variable is not set, the environment variable TMPDIR is used. If TMPDIR is not set then rq/tmprq is used.

to_chars
Type: string
Default: lq +TCFLrq
Controls the character used to indicate mail addressed to you. The first character is the one used when the mail is NOT addressed to your address (default: space). The second is used when you are the only recipient of the message (default: +). The third is when your address appears in the TO header field, but you are not the only recipient of the message (default: T). The fourth character is used when your address is specified in the CC header field, but you are not the only recipient. The fifth character is used to indicate mail that was sent by you. The sixth character is used to indicate when a mail was sent to a mailing-list you subscribe to (default: L).

tunnel
Type: string
Default: lqrq
Setting this variable will cause mutt to open a pipe to a command instead of a raw socket. You may be able to use this to set up preauthenticated connections to your IMAP/POP3 server. Example:
tunnel=rqssh -q mailhost.net /usr/local/libexec/imapdrq
NOTE: For this example to work you must be able to log in to the remote machine without having to enter a password.

use_8bitmime
Type: boolean
Default: no
Warning: do not set this variable unless you are using a version of sendmail which supports the -B8BITMIME flag (such as sendmail 8.8.x) or you may not be able to send mail.
When set, Mutt will invoke lq$sendmailrq with the -B8BITMIME flag when sending 8-bit messages to enable ESMTP negotiation.

use_domain
Type: boolean
Default: yes
When set, Mutt will qualify all local addresses (ones without the @host portion) with the value of lq$hostnamerq. If unset, no addresses will be qualified.

use_envelope_from
Type: boolean
Default: no
When set, mutt will set the envelope sender of the message. If lq$envelope_from_addressrq is set, it will be used as the sender address. If not, mutt will attempt to derive the sender from the rqFrom:rq header.
Note that this information is passed to sendmail command using the rq-frq command line switch. Therefore setting this option is not useful if the lq$sendmailrq variable already contains rq-frq or if the executable pointed to by $sendmail doesn't support the rq-frq switch.

use_from
Type: boolean
Default: yes
When set, Mutt will generate the `From:' header field when sending messages. If unset, no `From:' header field will be generated unless the user explicitly sets one using the lqmy_hdrrq command.

use_idn
Type: boolean
Default: yes
When set, Mutt will show you international domain names decoded. Note: You can use IDNs for addresses even if this is unset. This variable only affects decoding.

use_ipv6
Type: boolean
Default: yes
When set, Mutt will look for IPv6 addresses of hosts it tries to contact. If this option is unset, Mutt will restrict itself to IPv4 addresses. Normally, the default should work.

user_agent
Type: boolean
Default: yes
When set, mutt will add a rqUser-Agentrq header to outgoing messages, indicating which version of mutt was used for composing them.

visual
Type: path
Default: lqrq
Specifies the visual editor to invoke when the ~v command is given in the builtin editor.

wait_key
Type: boolean
Default: yes
Controls whether Mutt will ask you to press a key after shell- escape, pipe-message, pipe-entry, print-message, and print-entry commands.
It is also used when viewing attachments with lqauto_viewrq, provided that the corresponding mailcap entry has a needsterminal flag, and the external program is interactive.
When set, Mutt will always ask for a key. When unset, Mutt will wait for a key only if the external command returned a non-zero status.

weed
Type: boolean
Default: yes
When set, mutt will weed headers when displaying, forwarding, printing, or replying to messages.

wrap
Type: number
Default: 0
When set to a positive value, mutt will wrap text at $wrap characters. When set to a negative value, mutt will wrap text so that there are $wrap characters of empty space on the right side of the terminal.

wrap_search
Type: boolean
Default: yes
Controls whether searches wrap around the end of the mailbox.
When set, searches will wrap around the first (or last) message. When unset, searches will not wrap.

wrapmargin
Type: number
Default: 0
(DEPRECATED) Equivalent to setting wrap with a negative value.

write_inc
Type: number
Default: 10
When writing a mailbox, a message will be printed every write_inc messages to indicate progress. If set to 0, only a single message will be displayed before writing a mailbox.
Also see the lq$read_incrq variable.

write_bcc
Type: boolean
Default: yes
Controls whether mutt writes out the Bcc header when preparing messages to be sent. Exim users may wish to unset this. If mutt is set to deliver directly via SMTP (see lq$smtp_urlrq), this option does nothing: mutt will never write out the BCC header in this case.

 

SEE ALSO

iconv(1), iconv(3), mailcap(5), maildir(5), mbox(5), mutt(1), printf(3), regex(7), strftime(3)

The Mutt Manual

The Mutt home page: http://www.mutt.org/  

AUTHOR

Michael Elkins, and others. Use <mutt-dev@mutt.org> to contact the developers.


 

Index

NAME
DESCRIPTION
COMMANDS
PATTERNS
Constructing Patterns
Simple Patterns
Matching dates
CONFIGURATION VARIABLES
SEE ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 01:59:44 GMT, May 26, 2008

Man Mutt

Manpage of mutt

mutt

Section: User Manuals (1)
Updated: March 2007
Index Return to Main Contents
 

NAME

mutt - The Mutt Mail User Agent  

SYNOPSIS

mutt [-nRyzZ] [-e cmd] [-F file] [-m type] [-f file]

mutt [-nx] [-e cmd] [-F file] [-H file] [-i file] [-s subj] [-b addr] [-c addr] [-a file [...]] [--] addr [...]

mutt [-n] [-e cmd] [-F file] -p

mutt [-n] [-e cmd] [-F file] -A alias

mutt [-n] [-e cmd] [-F file] -Q query

mutt -v[v]

mutt -D  

DESCRIPTION

Mutt is a small but very powerful text based program for reading and sending electronic mail under unix operating systems, including support for color terminals, MIME, OpenPGP, and a threaded sorting mode.  

OPTIONS

-A alias
An expanded version of the given alias is passed to stdout.
-a file [...]
Attach a file to your message using MIME. To attach multiple files, separating filenames and recipient addresses with "--" is mandatory, e.g. mutt -a img.jpg *.png -- addr1 addr2.
-b address
Specify a blind-carbon-copy (BCC) recipient
-c address
Specify a carbon-copy (CC) recipient
-d level
If mutt was complied with +DEBUG log debugging output to ~/.muttdebug0. Level can range from 1-5 and effects verbosity. A value of 2 is recommended.
-D
Print the value of all configuration options to stdout.
-e command
Specify a configuration command to be run after processing of initialization files.
-f mailbox
Specify which mailbox to load.
-F muttrc
Specify an initialization file to read instead of ~/.muttrc
-h
Display help.
-H draft
Specify a draft file which contains header and body to use to send a message.
-i include
Specify a file to include into the body of a message.
-m type
specify a default mailbox type
-n
Causes Mutt to bypass the system configuration file.
-p
Resume a postponed message.
-Q query
Query a configuration variables value. The query is executed after all configuration files have been parsed, and any commands given on the command line have been executed.
-R
Open a mailbox in read-only mode.
-s subject
Specify the subject of the message.
-v
Display the Mutt version number and compile-time definitions.
-vv
Display license and copyright information.
-x
Emulate the mailx compose mode.
-y
Start Mutt with a listing of all mailboxes specified by the mailboxes command.
-z
When used with -f, causes Mutt not to start if there are no messages in the mailbox.
-Z
Causes Mutt to open the first mailbox specified by the mailboxes command which contains new mail.
--
Treat remaining arguments as addr even if they start with a dash. See also "-a" above.
 

ENVIRONMENT

EDITOR
Specifies the editor to use if VISUAL is unset.
EMAIL
The user's e-mail address.
HOME
Full path of the user's home directory.
MAIL
Full path of the user's spool mailbox.
MAILDIR
Full path of the user's spool mailbox. Commonly used when the spool mailbox is a maildir (5) folder.
MAILCAPS
Path to search for mailcap files.
MM_NOASK
If this variable is set, mailcap are always used without prompting first.
PGPPATH
Directory in which the user's PGP public keyring can be found.
TMPDIR
Directory in which temporary files are created.
REPLYTO
Default Reply-To address.
VISUAL
Specifies the editor to use when composing messages.
 

FILES

~/.muttrc or ~/.mutt/muttrc
User configuration file.
/opt/mutt/etc/Muttrc
System-wide configuration file.
/tmp/muttXXXXXX
Temporary files created by Mutt.
~/.mailcap
User definition for handling non-text MIME types.
/opt/mutt/etc/mailcap
System definition for handling non-text MIME types.
~/.mime.types
User's personal mapping between MIME types and file extensions.
/opt/mutt/etc/mime.types
System mapping between MIME types and file extensions.
/opt/mutt/bin/mutt_dotlock
The privileged dotlocking program.
/opt/mutt/share/doc/mutt/manual.txt
The Mutt manual.
 

BUGS

None. Mutts have fleas, not bugs.  

FLEAS

Suspend/resume while editing a file with an external editor does not work under SunOS 4.x if you use the curses lib in /usr/5lib. It does work with the S-Lang library, however.

Resizing the screen while using an external pager causes Mutt to go haywire on some systems.

Suspend/resume does not work under Ultrix.

The help line for the index menu is not updated if you change the bindings for one of the functions listed while Mutt is running.

For a more up-to-date list of bugs, errm, fleas, please visit the mutt project's bug tracking system under http://bugs.mutt.org/.  

NO WARRANTIES

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.  

SEE ALSO

curses(3), mailcap(5), maildir(5), mbox(5), mutt_dotlock(1), muttrc(5), ncurses(3), sendmail(1), smail(1).

Mutt Home Page: http://www.mutt.org/

The Mutt manual  

AUTHOR

Michael Elkins, and others. Use <mutt-dev@mutt.org> to contact the developers.


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
ENVIRONMENT
FILES
BUGS
FLEAS
NO WARRANTIES
SEE ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 01:59:26 GMT, May 26, 2008

Man Grep

Content-type: text/html Manpage of GREP

GREP

Section: User Commands (1)
Updated: 2002/01/22
Index Return to Main Contents
 

NAME

grep, egrep, fgrep - print lines matching a pattern  

SYNOPSIS

grep [options] PATTERN [FILE...]
grep [options] [-e PATTERN | -f FILE] [FILE...]  

DESCRIPTION

Grep searches the named input FILEs (or standard input if no files are named, or the file name - is given) for lines containing a match to the given PATTERN. By default, grep prints the matching lines.

In addition, two variant programs egrep and fgrep are available. Egrep is the same as grep -E. Fgrep is the same as grep -F.  

OPTIONS

-A NUM, --after-context=NUM
Print NUM lines of trailing context after matching lines. Places a line containing -- between contiguous groups of matches.
-a, --text
Process a binary file as if it were text; this is equivalent to the --binary-files=text option.
-B NUM, --before-context=NUM
Print NUM lines of leading context before matching lines. Places a line containing -- between contiguous groups of matches.
-C NUM, --context=NUM
Print NUM lines of output context. Places a line containing -- between contiguous groups of matches.
-b, --byte-offset
Print the byte offset within the input file before each line of output.
--binary-files=TYPE
If the first few bytes of a file indicate that the file contains binary data, assume that the file is of type TYPE. By default, TYPE is binary, and grep normally outputs either a one-line message saying that a binary file matches, or no message if there is no match. If TYPE is without-match, grep assumes that a binary file does not match; this is equivalent to the -I option. If TYPE is text, grep processes a binary file as if it were text; this is equivalent to the -a option. Warning: grep --binary-files=text might output binary garbage, which can have nasty side effects if the output is a terminal and if the terminal driver interprets some of it as commands.
--colour[=WHEN], --color[=WHEN]
Surround the matching string with the marker find in GREP_COLOR environment variable. WHEN may be `never', `always', or `auto'
-c, --count
Suppress normal output; instead print a count of matching lines for each input file. With the -v, --invert-match option (see below), count non-matching lines.
-D ACTION, --devices=ACTION
If an input file is a device, FIFO or socket, use ACTION to process it. By default, ACTION is read, which means that devices are read just as if they were ordinary files. If ACTION is skip, devices are silently skipped.
-d ACTION, --directories=ACTION
If an input file is a directory, use ACTION to process it. By default, ACTION is read, which means that directories are read just as if they were ordinary files. If ACTION is skip, directories are silently skipped. If ACTION is recurse, grep reads all files under each directory, recursively; this is equivalent to the -r option.
-E, --extended-regexp
Interpret PATTERN as an extended regular expression (see below).
-e PATTERN, --regexp=PATTERN
Use PATTERN as the pattern; useful to protect patterns beginning with -.
-F, --fixed-strings
Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched.
-P, --perl-regexp
Interpret PATTERN as a Perl regular expression.
-f FILE, --file=FILE
Obtain patterns from FILE, one per line. The empty file contains zero patterns, and therefore matches nothing.
-G, --basic-regexp
Interpret PATTERN as a basic regular expression (see below). This is the default.
-H, --with-filename
Print the filename for each match.
-h, --no-filename
Suppress the prefixing of filenames on output when multiple files are searched.
--help
Output a brief help message.
-I
Process a binary file as if it did not contain matching data; this is equivalent to the --binary-files=without-match option.
-i, --ignore-case
Ignore case distinctions in both the PATTERN and the input files.
-L, --files-without-match
Suppress normal output; instead print the name of each input file from which no output would normally have been printed. The scanning will stop on the first match.
-l, --files-with-matches
Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match.
-m NUM, --max-count=NUM
Stop reading a file after NUM matching lines. If the input is standard input from a regular file, and NUM matching lines are output, grep ensures that the standard input is positioned to just after the last matching line before exiting, regardless of the presence of trailing context lines. This enables a calling process to resume a search. When grep stops after NUM matching lines, it outputs any trailing context lines. When the -c or --count option is also used, grep does not output a count greater than NUM. When the -v or --invert-match option is also used, grep stops after outputting NUM non-matching lines.
--mmap
If possible, use the mmap(2) system call to read input, instead of the default read(2) system call. In some situations, --mmap yields better performance. However, --mmap can cause undefined behavior (including core dumps) if an input file shrinks while grep is operating, or if an I/O error occurs.
-n, --line-number
Prefix each line of output with the line number within its input file.
-o, --only-matching
Show only the part of a matching line that matches PATTERN.
--label=LABEL
Displays input actually coming from standard input as input coming from file LABEL. This is especially useful for tools like zgrep, e.g. gzip -cd foo.gz |grep --label=foo something
--line-buffered
Use line buffering, it can be a performance penality.
-q, --quiet, --silent
Quiet; do not write anything to standard output. Exit immediately with zero status if any match is found, even if an error was detected. Also see the -s or --no-messages option.
-R, -r, --recursive
Read all files under each directory, recursively; this is equivalent to the -d recurse option.
--include=PATTERN
Recurse in directories only searching file matching PATTERN.
--exclude=PATTERN
Recurse in directories skip file matching PATTERN.
-s, --no-messages
Suppress error messages about nonexistent or unreadable files. Portability note: unlike GNU grep, traditional grep did not conform to POSIX.2, because traditional grep lacked a -q option and its -s option behaved like GNU grep's -q option. Shell scripts intended to be portable to traditional grep should avoid both -q and -s and should redirect output to /dev/null instead.
-U, --binary
Treat the file(s) as binary. By default, under MS-DOS and MS-Windows, grep guesses the file type by looking at the contents of the first 32KB read from the file. If grep decides the file is a text file, it strips the CR characters from the original file contents (to make regular expressions with ^ and $ work correctly). Specifying -U overrules this guesswork, causing all files to be read and passed to the matching mechanism verbatim; if the file is a text file with CR/LF pairs at the end of each line, this will cause some regular expressions to fail. This option has no effect on platforms other than MS-DOS and MS-Windows.
-u, --unix-byte-offsets
Report Unix-style byte offsets. This switch causes grep to report byte offsets as if the file were Unix-style text file, i.e. with CR characters stripped off. This will produce results identical to running grep on a Unix machine. This option has no effect unless -b option is also used; it has no effect on platforms other than MS-DOS and MS-Windows.
-V, --version
Print the version number of grep to standard error. This version number should be included in all bug reports (see below).
-v, --invert-match
Invert the sense of matching, to select non-matching lines.
-w, --word-regexp
Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word-constituent characters are letters, digits, and the underscore.
-x, --line-regexp
Select only those matches that exactly match the whole line.
-y
Obsolete synonym for -i.
-Z, --null
Output a zero byte (the ASCII NUL character) instead of the character that normally follows a file name. For example, grep -lZ outputs a zero byte after each file name instead of the usual newline. This option makes the output unambiguous, even in the presence of file names containing unusual characters like newlines. This option can be used with commands like find -print0, perl -0, sort -z, and xargs -0 to process arbitrary file names, even those that contain newline characters.
 

REGULAR EXPRESSIONS

A regular expression is a pattern that describes a set of strings. Regular expressions are constructed analogously to arithmetic expressions, by using various operators to combine smaller expressions.

Grep understands two different versions of regular expression syntax: ``basic'' and ``extended.'' In GNU grep, there is no difference in available functionality using either syntax. In other implementations, basic regular expressions are less powerful. The following description applies to extended regular expressions; differences for basic regular expressions are summarized afterwards.

The fundamental building blocks are the regular expressions that match a single character. Most characters, including all letters and digits, are regular expressions that match themselves. Any metacharacter with special meaning may be quoted by preceding it with a backslash.

A bracket expression is a list of characters enclosed by [ and ]. It matches any single character in that list; if the first character of the list is the caret ^ then it matches any character not in the list. For example, the regular expression [0123456789] matches any single digit.

Within a bracket expression, a range expression consists of two characters separated by a hyphen. It matches any single character that sorts between the two characters, inclusive, using the locale's collating sequence and character set. For example, in the default C locale, [a-d] is equivalent to [abcd]. Many locales sort characters in dictionary order, and in these locales [a-d] is typically not equivalent to [abcd]; it might be equivalent to [aBbCcDd], for example. To obtain the traditional interpretation of bracket expressions, you can use the C locale by setting the LC_ALL environment variable to the value C.

Finally, certain named classes of characters are predefined within bracket expressions, as follows. Their names are self explanatory, and they are [:alnum:], [:alpha:], [:cntrl:], [:digit:], [:graph:], [:lower:], [:print:], [:punct:], [:space:], [:upper:], and [:xdigit:]. For example, [[:alnum:]] means [0-9A-Za-z], except the latter form depends upon the C locale and the ASCII character encoding, whereas the former is independent of locale and character set. (Note that the brackets in these class names are part of the symbolic names, and must be included in addition to the brackets delimiting the bracket list.) Most metacharacters lose their special meaning inside lists. To include a literal ] place it first in the list. Similarly, to include a literal ^ place it anywhere but first. Finally, to include a literal - place it last.

The period . matches any single character. The symbol \w is a synonym for [[:alnum:]] and \W is a synonym for [^[:alnum]].

The caret ^ and the dollar sign $ are metacharacters that respectively match the empty string at the beginning and end of a line. The symbols \< and \> respectively match the empty string at the beginning and end of a word. The symbol \b matches the empty string at the edge of a word, and \B matches the empty string provided it's not at the edge of a word.

A regular expression may be followed by one of several repetition operators:

?
The preceding item is optional and matched at most once.
*
The preceding item will be matched zero or more times.
+
The preceding item will be matched one or more times.
{n}
The preceding item is matched exactly n times.
{n,}
The preceding item is matched n or more times.
{n,m}
The preceding item is matched at least n times, but not more than m times.

Two regular expressions may be concatenated; the resulting regular expression matches any string formed by concatenating two substrings that respectively match the concatenated subexpressions.

Two regular expressions may be joined by the infix operator |; the resulting regular expression matches any string matching either subexpression.

Repetition takes precedence over concatenation, which in turn takes precedence over alternation. A whole subexpression may be enclosed in parentheses to override these precedence rules.

The backreference \n, where n is a single digit, matches the substring previously matched by the nth parenthesized subexpression of the regular expression.

In basic regular expressions the metacharacters ?, +, {, |, (, and ) lose their special meaning; instead use the backslashed versions \?, \+, \{, \|, \(, and \).

Traditional egrep did not support the { metacharacter, and some egrep implementations support \{ instead, so portable scripts should avoid { in egrep patterns and should use [{] to match a literal {.

GNU egrep attempts to support traditional usage by assuming that { is not special if it would be the start of an invalid interval specification. For example, the shell command egrep '{1' searches for the two-character string {1 instead of reporting a syntax error in the regular expression. POSIX.2 allows this behavior as an extension, but portable scripts should avoid it.  

ENVIRONMENT VARIABLES

Grep's behavior is affected by the following environment variables.

A locale LC_foo is specified by examining the three environment variables LC_ALL, LC_foo, LANG, in that order. The first of these variables that is set specifies the locale. For example, if LC_ALL is not set, but LC_MESSAGES is set to pt_BR, then Brazilian Portuguese is used for the LC_MESSAGES locale. The C locale is used if none of these environment variables are set, or if the locale catalog is not installed, or if grep was not compiled with national language support (NLS).

GREP_OPTIONS
This variable specifies default options to be placed in front of any explicit options. For example, if GREP_OPTIONS is '--binary-files=without-match --directories=skip', grep behaves as if the two options --binary-files=without-match and --directories=skip had been specified before any explicit options. Option specifications are separated by whitespace. A backslash escapes the next character, so it can be used to specify an option containing whitespace or a backslash.
GREP_COLOR
Specifies the marker for highlighting.
LC_ALL, LC_COLLATE, LANG
These variables specify the LC_COLLATE locale, which determines the collating sequence used to interpret range expressions like [a-z].
LC_ALL, LC_CTYPE, LANG
These variables specify the LC_CTYPE locale, which determines the type of characters, e.g., which characters are whitespace.
LC_ALL, LC_MESSAGES, LANG
These variables specify the LC_MESSAGES locale, which determines the language that grep uses for messages. The default C locale uses American English messages.
POSIXLY_CORRECT
If set, grep behaves as POSIX.2 requires; otherwise, grep behaves more like other GNU programs. POSIX.2 requires that options that follow file names must be treated as file names; by default, such options are permuted to the front of the operand list and are treated as options. Also, POSIX.2 requires that unrecognized options be diagnosed as ``illegal'', but since they are not really against the law the default is to diagnose them as ``invalid''. POSIXLY_CORRECT also disables _N_GNU_nonoption_argv_flags_, described below.
_N_GNU_nonoption_argv_flags_
(Here N is grep's numeric process ID.) If the ith character of this environment variable's value is 1, do not consider the ith operand of grep to be an option, even if it appears to be one. A shell can put this variable in the environment for each command it runs, specifying which operands are the results of file name wildcard expansion and therefore should not be treated as options. This behavior is available only with the GNU C library, and only when POSIXLY_CORRECT is not set.
 

DIAGNOSTICS

Normally, exit status is 0 if selected lines are found and 1 otherwise. But the exit status is 2 if an error occurred, unless the -q or --quiet or --silent option is used and a selected line is found.  

BUGS

Email bug reports to bug-grep@gnu.org.

Large repetition counts in the {n,m} construct may cause grep to use lots of memory. In addition, certain other obscure regular expressions require exponential time and space, and may cause grep to run out of memory.

Backreferences are very slow, and may require exponential time.


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
REGULAR EXPRESSIONS
ENVIRONMENT VARIABLES
DIAGNOSTICS
BUGS

This document was created by man2html, using the manual pages.
Time: 14:59:21 GMT, June 17, 2008

Man Sed

Manpage of SED

SED

Section: User Commands (1)
Updated: June 2006
Index Return to Main Contents
 

NAME

sed - stream editor for filtering and transforming text  

SYNOPSIS

sed [OPTION]... {script-only-if-no-other-script} [input-file]...  

DESCRIPTION

Sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). While in some ways similar to an editor which permits scripted edits (such as ed), sed works by making only one pass over the input(s), and is consequently more efficient. But it is sed's ability to filter text in a pipeline which particularly distinguishes it from other types of editors.
-n, --quiet, --silent
suppress automatic printing of pattern space
-e script, --expression=script
add the script to the commands to be executed
-f script-file, --file=script-file
add the contents of script-file to the commands to be executed
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if extension supplied)
-c, --copy
use copy instead of rename when shuffling files in -i mode (avoids change of input file ownership)
-l N, --line-length=N
specify the desired line-wrap length for the `l' command
--posix
disable all GNU extensions.
-r, --regexp-extended
use extended regular expressions in the script.
-s, --separate
consider files as separate rather than as a single continuous long stream.
-u, --unbuffered
load minimal amounts of data from the input files and flush the output buffers more often
--help
display this help and exit
--version
output version information and exit

If no -e, --expression, -f, or --file option is given, then the first non-option argument is taken as the sed script to interpret. All remaining arguments are names of input files; if no input files are specified, then the standard input is read.

E-mail bug reports to: bonzini@gnu.org . Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.  

COMMAND SYNOPSIS

This is just a brief synopsis of sed commands to serve as a reminder to those who already know sed; other documentation (such as the texinfo document) must be consulted for fuller descriptions.  

Zero-address ``commands''

label
Label for b and t commands.
#comment
The comment extends until the next newline (or the end of a -e script fragment).
}
The closing bracket of a { } block.
 

Zero- or One- address commands

=
Print the current line number.
a \
text
Append text, which has each embedded newline preceded by a backslash.
i \
text
Insert text, which has each embedded newline preceded by a backslash.
q
Immediately quit the sed script without processing any more input, except that if auto-print is not disabled the current pattern space will be printed.
Q
Immediately quit the sed script without processing any more input.
filename
Append text read from filename.
filename
Append a line read from filename.
 

Commands which accept address ranges

{
Begin a block of commands (end with a }).
label
Branch to label; if label is omitted, branch to end of script.
label
If a s/// has done a successful substitution since the last input line was read and since the last t or T command, then branch to label; if label is omitted, branch to end of script.
label
If no s/// has done a successful substitution since the last input line was read and since the last t or T command, then branch to label; if label is omitted, branch to end of script.
c \
text
Replace the selected lines with text, which has each embedded newline preceded by a backslash.
d
Delete pattern space. Start next cycle.
D
Delete up to the first embedded newline in the pattern space. Start next cycle, but skip reading from the input if there is still data in the pattern space.
h H
Copy/append pattern space to hold space.
g G
Copy/append hold space to pattern space.
x
Exchange the contents of the hold and pattern spaces.
l
List out the current line in a ``visually unambiguous'' form.
n N
Read/append the next line of input into the pattern space.
p
Print the current pattern space.
P
Print up to the first embedded newline of the current pattern space.
s/regexp/replacement/
Attempt to match regexp against the pattern space. If successful, replace that portion matched with replacement. The replacement may contain the special character & to refer to that portion of the pattern space which matched, and the special escapes \1 through \9 to refer to the corresponding matching sub-expressions in the regexp.
filename
Write the current pattern space to filename.
filename
Write the first line of the current pattern space to filename.
y/source/dest/
Transliterate the characters in the pattern space which appear in source to the corresponding character in dest.
 

Addresses

Sed commands can be given with no addresses, in which case the command will be executed for all input lines; with one address, in which case the command will only be executed for input lines which match that address; or with two addresses, in which case the command will be executed for all input lines which match the inclusive range of lines starting from the first address and continuing to the second address. Three things to note about address ranges: the syntax is addr1,addr2 (i.e., the addresses are separated by a comma); the line which addr1 matched will always be accepted, even if addr2 selects an earlier line; and if addr2 is a regexp, it will not be tested against the line that addr1 matched.

After the address (or address-range), and before the command, a ! may be inserted, which specifies that the command shall only be executed if the address (or address-range) does not match.

The following address types are supported:

number
Match only the specified line number.
first~step
Match every step'th line starting with line first. For example, ``sed -n 1~2p'' will print all the odd-numbered lines in the input stream, and the address 2~5 will match every fifth line, starting with the second. (This is an extension.)
$
Match the last line.
/regexp/
Match lines matching the regular expression regexp.
\cregexpc
Match lines matching the regular expression regexp. The c may be any character.

GNU sed also supports some special 2-address forms:

0,addr2
Start out in "matched first address" state, until addr2 is found. This is similar to 1,addr2, except that if addr2 matches the very first line of input the 0,addr2 form will be at the end of its range, whereas the 1,addr2 form will still be at the beginning of its range.
addr1,+N
Will match addr1 and the N lines following addr1.
addr1,~N
Will match addr1 and the lines following addr1 until the next line whose input line number is a multiple of N.
 

REGULAR EXPRESSIONS

POSIX.2 BREs should be supported, but they aren't completely because of performance problems. The \n sequence in a regular expression matches the newline character, and similarly for \a, \t, and other sequences.  

BUGS

E-mail bug reports to bonzini@gnu.org. Be sure to include the word ``sed'' somewhere in the ``Subject:'' field. Also, please include the output of ``sed --version'' in the body of your report if at all possible.  

COPYRIGHT

Copyright © 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, to the extent permitted by law.  

SEE ALSO

awk(1), ed(1), grep(1), tr(1), perlre(1), sed.info, any of various books on sed, the sed FAQ (http://sed.sf.net/grabbag/tutorials/sedfaq.txt), http://sed.sf.net/grabbag/.

The full documentation for sed is maintained as a Texinfo manual. If the info and sed programs are properly installed at your site, the command

info sed

should give you access to the complete manual.


 

Index

NAME
SYNOPSIS
DESCRIPTION
COMMAND SYNOPSIS
Zero-address ``commands''
Zero- or One- address commands
Commands which accept address ranges
Addresses
REGULAR EXPRESSIONS
BUGS
COPYRIGHT
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 01:59:13 GMT, May 26, 2008

Man Awk

Manpage of GAWK

GAWK

Section: Utility Commands (1)
Updated: June 26 2005
Index Return to Main Contents
 

NAME

gawk - pattern scanning and processing language  

SYNOPSIS

gawk [ POSIX or GNU style options ] -f program-file [ -- ] file ...
gawk [ POSIX or GNU style options ] [ -- ] program-text file ...

pgawk [ POSIX or GNU style options ] -f program-file [ -- ] file ...
pgawk [ POSIX or GNU style options ] [ -- ] program-text file ...  

DESCRIPTION

Gawk is the GNU Project's implementation of the AWK programming language. It conforms to the definition of the language in the POSIX 1003.2 Command Language And Utilities Standard. This version in turn is based on the description in The AWK Programming Language, by Aho, Kernighan, and Weinberger, with the additional features found in the System V Release 4 version of UNIX awk. Gawk also provides more recent Bell Laboratories awk extensions, and a number of GNU-specific extensions.

Pgawk is the profiling version of gawk. It is identical in every way to gawk, except that programs run more slowly, and it automatically produces an execution profile in the file awkprof.out when done. See the --profile option, below.

The command line consists of options to gawk itself, the AWK program text (if not supplied via the -f or --file options), and values to be made available in the ARGC and ARGV pre-defined AWK variables.  

OPTION FORMAT

Gawk options may be either traditional POSIX one letter options, or GNU style long options. POSIX options start with a single ``-'', while long options start with ``--''. Long options are provided for both GNU-specific features and for POSIX-mandated features.

Following the POSIX standard, gawk-specific options are supplied via arguments to the -W option. Multiple -W options may be supplied Each -W option has a corresponding long option, as detailed below. Arguments to long options are either joined with the option by an = sign, with no intervening spaces, or they may be provided in the next command line argument. Long options may be abbreviated, as long as the abbreviation remains unique.  

OPTIONS

Gawk accepts the following options, listed alphabetically.

-F fs
--field-separator fs Use fs for the input field separator (the value of the FS predefined variable).
-v var=val
--assign var=val Assign the value val to the variable var, before execution of the program begins. Such variable values are available to the BEGIN block of an AWK program.
-f program-file
--file program-file Read the AWK program source from the file program-file, instead of from the first command line argument. Multiple -f (or --file) options may be used.
-mf NNN
-mr NNN Set various memory limits to the value NNN. The f flag sets the maximum number of fields, and the r flag sets the maximum record size. These two flags and the -m option are from the Bell Laboratories research version of UNIX awk. They are ignored by gawk, since gawk has no pre-defined limits.
-W compat
-W traditional
--compat
--traditional Run in compatibility mode. In compatibility mode, gawk behaves identically to UNIX awk; none of the GNU-specific extensions are recognized. The use of --traditional is preferred over the other forms of this option. See GNU EXTENSIONS, below, for more information.
-W copyleft
-W copyright
--copyleft
--copyright Print the short version of the GNU copyright information message on the standard output and exit successfully.
-W dump-variables[=file]
--dump-variables[=file] Print a sorted list of global variables, their types and final values to file. If no file is provided, gawk uses a file named awkvars.out in the current directory.

Having a list of all the global variables is a good way to look for typographical errors in your programs. You would also use this option if you have a large program with a lot of functions, and you want to be sure that your functions don't inadvertently use global variables that you meant to be local. (This is a particularly easy mistake to make with simple variable names like i, j, and so on.)

-W exec file
--exec file Similar to -f, however, this is option is the last one processed. This should be used with #! scripts, particularly for CGI applications, to avoid passing in options or source code (!) on the command line from a URL. This option disables command-line variable assignments.
-W gen-po
--gen-po Scan and parse the AWK program, and generate a GNU .po format file on standard output with entries for all localizable strings in the program. The program itself is not executed. See the GNU gettext distribution for more information on .po files.
-W help
-W usage
--help
--usage Print a relatively short summary of the available options on the standard output. (Per the GNU Coding Standards, these options cause an immediate, successful exit.)
-W lint[=value]
--lint[=value] Provide warnings about constructs that are dubious or non-portable to other AWK implementations. With an optional argument of fatal, lint warnings become fatal errors. This may be drastic, but its use will certainly encourage the development of cleaner AWK programs. With an optional argument of invalid, only warnings about things that are actually invalid are issued. (This is not fully implemented yet.)
-W lint-old
--lint-old Provide warnings about constructs that are not portable to the original version of Unix awk.
-W non-decimal-data
--non-decimal-data Recognize octal and hexadecimal values in input data. Use this option with great caution!
-W posix
--posix This turns on compatibility mode, with the following additional restrictions:
*
\x escape sequences are not recognized.
*
Only space and tab act as field separators when FS is set to a single space, newline does not.
*
You cannot continue lines after ? and :.
*
The synonym func for the keyword function is not recognized.
*
The operators ** and **= cannot be used in place of ^ and ^=.
*
The fflush() function is not available.
-W profile[=prof_file]
--profile[=prof_file] Send profiling data to prof_file. The default is awkprof.out. When run with gawk, the profile is just a ``pretty printed'' version of the program. When run with pgawk, the profile contains execution counts of each statement in the program in the left margin and function call counts for each user-defined function.
-W re-interval
--re-interval Enable the use of interval expressions in regular expression matching (see Regular Expressions, below). Interval expressions were not traditionally available in the AWK language. The POSIX standard added them, to make awk and egrep consistent with each other. However, their use is likely to break old AWK programs, so gawk only provides them if they are requested with this option, or when --posix is specified.
-W source program-text
--source program-text Use program-text as AWK program source code. This option allows the easy intermixing of library functions (used via the -f and --file options) with source code entered on the command line. It is intended primarily for medium to large AWK programs used in shell scripts.
-W version
--version Print version information for this particular copy of gawk on the standard output. This is useful mainly for knowing if the current copy of gawk on your system is up to date with respect to whatever the Free Software Foundation is distributing. This is also useful when reporting bugs. (Per the GNU Coding Standards, these options cause an immediate, successful exit.)
-- Signal the end of options. This is useful to allow further arguments to the AWK program itself to start with a ``-''. This is mainly for consistency with the argument parsing convention used by most other POSIX programs.

In compatibility mode, any other options are flagged as invalid, but are otherwise ignored. In normal operation, as long as program text has been supplied, unknown options are passed on to the AWK program in the ARGV array for processing. This is particularly useful for running AWK programs via the ``#!'' executable interpreter mechanism.  

AWK PROGRAM EXECUTION

An AWK program consists of a sequence of pattern-action statements and optional function definitions.

pattern        { action statements }

function name(parameter list) { statements }

Gawk first reads the program source from the program-file(s) if specified, from arguments to --source, or from the first non-option argument on the command line. The -f and --source options may be used multiple times on the command line. Gawk reads the program text as if all the program-files and command line source texts had been concatenated together. This is useful for building libraries of AWK functions, without having to include them in each new AWK program that uses them. It also provides the ability to mix library functions with command line programs.

The environment variable AWKPATH specifies a search path to use when finding source files named with the -f option. If this variable does not exist, the default path is ".:/usr/local/share/awk". (The actual directory may vary, depending upon how gawk was built and installed.) If a file name given to the -f option contains a ``/'' character, no path search is performed.

Gawk executes AWK programs in the following order. First, all variable assignments specified via the -v option are performed. Next, gawk compiles the program into an internal form. Then, gawk executes the code in the BEGIN block(s) (if any), and then proceeds to read each file named in the ARGV array. If there are no files named on the command line, gawk reads the standard input.

If a filename on the command line has the form var=val it is treated as a variable assignment. The variable var will be assigned the value val. (This happens after any BEGIN block(s) have been run.) Command line variable assignment is most useful for dynamically assigning values to the variables AWK uses to control how input is broken into fields and records. It is also useful for controlling state if multiple passes are needed over a single data file.

If the value of a particular element of ARGV is empty (""), gawk skips over it.

For each record in the input, gawk tests to see if it matches any pattern in the AWK program. For each pattern that the record matches, the associated action is executed. The patterns are tested in the order they occur in the program.

Finally, after all the input is exhausted, gawk executes the code in the END block(s) (if any).  

VARIABLES, RECORDS AND FIELDS

AWK variables are dynamic; they come into existence when they are first used. Their values are either floating-point numbers or strings, or both, depending upon how they are used. AWK also has one dimensional arrays; arrays with multiple dimensions may be simulated. Several pre-defined variables are set as a program runs; these will be described as needed and summarized below.  

Records

Normally, records are separated by newline characters. You can control how records are separated by assigning values to the built-in variable RS. If RS is any single character, that character separates records. Otherwise, RS is a regular expression. Text in the input that matches this regular expression separates the record. However, in compatibility mode, only the first character of its string value is used for separating records. If RS is set to the null string, then records are separated by blank lines. When RS is set to the null string, the newline character always acts as a field separator, in addition to whatever value FS may have.  

Fields

As each input record is read, gawk splits the record into fields, using the value of the FS variable as the field separator. If FS is a single character, fields are separated by that character. If FS is the null string, then each individual character becomes a separate field. Otherwise, FS is expected to be a full regular expression. In the special case that FS is a single space, fields are separated by runs of spaces and/or tabs and/or newlines. (But see the discussion of --posix, below). NOTE: The value of IGNORECASE (see below) also affects how fields are split when FS is a regular expression, and how records are separated when RS is a regular expression.

If the FIELDWIDTHS variable is set to a space separated list of numbers, each field is expected to have fixed width, and gawk splits up the record using the specified widths. The value of FS is ignored. Assigning a new value to FS overrides the use of FIELDWIDTHS, and restores the default behavior.

Each field in the input record may be referenced by its position, $1, $2, and so on. $0 is the whole record. Fields need not be referenced by constants:

n = 5
print $n

prints the fifth field in the input record.

The variable NF is set to the total number of fields in the input record.

References to non-existent fields (i.e. fields after $NF) produce the null-string. However, assigning to a non-existent field (e.g., $(NF+2) = 5) increases the value of NF, creates any intervening fields with the null string as their value, and causes the value of $0 to be recomputed, with the fields being separated by the value of OFS. References to negative numbered fields cause a fatal error. Decrementing NF causes the values of fields past the new value to be lost, and the value of $0 to be recomputed, with the fields being separated by the value of OFS.

Assigning a value to an existing field causes the whole record to be rebuilt when $0 is referenced. Similarly, assigning a value to $0 causes the record to be resplit, creating new values for the fields.  

Built-in Variables

Gawk's built-in variables are:

ARGC
The number of command line arguments (does not include options to gawk, or the program source).
ARGIND
The index in ARGV of the current file being processed.
ARGV
Array of command line arguments. The array is indexed from 0 to ARGC - 1. Dynamically changing the contents of ARGV can control the files used for data.
BINMODE
On non-POSIX systems, specifies use of ``binary'' mode for all file I/O. Numeric values of 1, 2, or 3, specify that input files, output files, or all files, respectively, should use binary I/O. String values of "r", or "w" specify that input files, or output files, respectively, should use binary I/O. String values of "rw" or "wr" specify that all files should use binary I/O. Any other string value is treated as "rw", but generates a warning message.
CONVFMT
The conversion format for numbers, "%.6g", by default.
ENVIRON
An array containing the values of the current environment. The array is indexed by the environment variables, each element being the value of that variable (e.g., ENVIRON["HOME"] might be /home/arnold). Changing this array does not affect the environment seen by programs which gawk spawns via redirection or the system() function.
ERRNO
If a system error occurs either doing a redirection for getline, during a read for getline, or during a close(), then ERRNO will contain a string describing the error. The value is subject to translation in non-English locales.
FIELDWIDTHS
A white-space separated list of fieldwidths. When set, gawk parses the input into fields of fixed width, instead of using the value of the FS variable as the field separator.
FILENAME
The name of the current input file. If no files are specified on the command line, the value of FILENAME is ``-''. However, FILENAME is undefined inside the BEGIN block (unless set by getline).
FNR
The input record number in the current input file.
FS
The input field separator, a space by default. See Fields, above.
IGNORECASE
Controls the case-sensitivity of all regular expression and string operations. If IGNORECASE has a non-zero value, then string comparisons and pattern matching in rules, field splitting with FS, record separating with RS, regular expression matching with ~ and !~, and the gensub(), gsub(), index(), match(), split(), and sub() built-in functions all ignore case when doing regular expression operations. NOTE: Array subscripting is not affected. However, the asort() and asorti() functions are affected.

Thus, if IGNORECASE is not equal to zero, /aB/ matches all of the strings "ab", "aB", "Ab", and "AB". As with all AWK variables, the initial value of IGNORECASE is zero, so all regular expression and string operations are normally case-sensitive. Under Unix, the full ISO 8859-1 Latin-1 character set is used when ignoring case. As of gawk 3.1.4, the case equivalencies are fully locale-aware, based on the C <ctype.h> facilities such as isalpha(), and tolupper().

LINT
Provides dynamic control of the --lint option from within an AWK program. When true, gawk prints lint warnings. When false, it does not. When assigned the string value "fatal", lint warnings become fatal errors, exactly like --lint=fatal. Any other true value just prints warnings.
NF
The number of fields in the current input record.
NR
The total number of input records seen so far.
OFMT
The output format for numbers, "%.6g", by default.
OFS
The output field separator, a space by default.
ORS
The output record separator, by default a newline.
PROCINFO
The elements of this array provide access to information about the running AWK program. On some systems, there may be elements in the array, "group1" through "groupn" for some n, which is the number of supplementary groups that the process has. Use the in operator to test for these elements. The following elements are guaranteed to be available:
PROCINFO["egid"]
the value of the getegid(2) system call.
PROCINFO["euid"]
the value of the geteuid(2) system call.
PROCINFO["FS"]
"FS" if field splitting with FS is in effect, or "FIELDWIDTHS" if field splitting with FIELDWIDTHS is in effect.
PROCINFO["gid"]
the value of the getgid(2) system call.
PROCINFO["pgrpid"]
the process group ID of the current process.
PROCINFO["pid"]
the process ID of the current process.
PROCINFO["ppid"]
the parent process ID of the current process.
PROCINFO["uid"]
the value of the getuid(2) system call.
PROCINFO["version"]
The version of gawk. This is available from version 3.1.4 and later.
RS
The input record separator, by default a newline.
RT
The record terminator. Gawk sets RT to the input text that matched the character or regular expression specified by RS.
RSTART
The index of the first character matched by match(); 0 if no match. (This implies that character indices start at one.)
RLENGTH
The length of the string matched by match(); -1 if no match.
SUBSEP
The character used to separate multiple subscripts in array elements, by default "\034".
TEXTDOMAIN
The text domain of the AWK program; used to find the localized translations for the program's strings.
 

Arrays

Arrays are subscripted with an expression between square brackets ([ and ]). If the expression is an expression list (expr, expr ...) then the array subscript is a string consisting of the concatenation of the (string) value of each expression, separated by the value of the SUBSEP variable. This facility is used to simulate multiply dimensioned arrays. For example:

i = "A"; j = "B"; k = "C"
x[i, j, k] = "hello, world\n"

assigns the string "hello, world\n" to the element of the array x which is indexed by the string "A\034B\034C". All arrays in AWK are associative, i.e. indexed by string values.

The special operator in may be used in an if or while statement to see if an array has an index consisting of a particular value.

if (val in array)
        print array[val]

If the array has multiple subscripts, use (i, j) in array.

The in construct may also be used in a for loop to iterate over all the elements of an array.

An element may be deleted from an array using the delete statement. The delete statement may also be used to delete the entire contents of an array, just by specifying the array name without a subscript.  

Variable Typing And Conversion

Variables and fields may be (floating point) numbers, or strings, or both. How the value of a variable is interpreted depends upon its context. If used in a numeric expression, it will be treated as a number, if used as a string it will be treated as a string.

To force a variable to be treated as a number, add 0 to it; to force it to be treated as a string, concatenate it with the null string.

When a string must be converted to a number, the conversion is accomplished using strtod(3). A number is converted to a string by using the value of CONVFMT as a format string for sprintf(3), with the numeric value of the variable as the argument. However, even though all numbers in AWK are floating-point, integral values are always converted as integers. Thus, given

CONVFMT = "%2.2f"
a = 12
b = a ""

the variable b has a string value of "12" and not "12.00".

Gawk performs comparisons as follows: If two variables are numeric, they are compared numerically. If one value is numeric and the other has a string value that is a ``numeric string,'' then comparisons are also done numerically. Otherwise, the numeric value is converted to a string and a string comparison is performed. Two strings are compared, of course, as strings. Note that the POSIX standard applies the concept of ``numeric string'' everywhere, even to string constants. However, this is clearly incorrect, and gawk does not do this. (Fortunately, this is fixed in the next version of the standard.)

Note that string constants, such as "57", are not numeric strings, they are string constants. The idea of ``numeric string'' only applies to fields, getline input, FILENAME, ARGV elements, ENVIRON elements and the elements of an array created by split() that are numeric strings. The basic idea is that user input, and only user input, that looks numeric, should be treated that way.

Uninitialized variables have the numeric value 0 and the string value "" (the null, or empty, string).  

Octal and Hexadecimal Constants

Starting with version 3.1 of gawk , you may use C-style octal and hexadecimal constants in your AWK program source code. For example, the octal value 011 is equal to decimal 9, and the hexadecimal value 0x11 is equal to decimal 17.  

String Constants

String constants in AWK are sequences of characters enclosed between double quotes ("). Within strings, certain escape sequences are recognized, as in C. These are:

\\
A literal backslash.
\a
The ``alert'' character; usually the ASCII BEL character.
\b
backspace.
\f
form-feed.
\n
newline.
\r
carriage return.
\t
horizontal tab.
\v
vertical tab.
\xhex digits
The character represented by the string of hexadecimal digits following the \x. As in ANSI C, all following hexadecimal digits are considered part of the escape sequence. (This feature should tell us something about language design by committee.) E.g., "\x1B" is the ASCII ESC (escape) character.
\ddd
The character represented by the 1-, 2-, or 3-digit sequence of octal digits. E.g., "\033" is the ASCII ESC (escape) character.
\c
The literal character c.

The escape sequences may also be used inside constant regular expressions (e.g., /[ \t\f\n\r\v]/ matches whitespace characters).

In compatibility mode, the characters represented by octal and hexadecimal escape sequences are treated literally when used in regular expression constants. Thus, /a\52b/ is equivalent to /a\*b/.  

PATTERNS AND ACTIONS

AWK is a line-oriented language. The pattern comes first, and then the action. Action statements are enclosed in { and }. Either the pattern may be missing, or the action may be missing, but, of course, not both. If the pattern is missing, the action is executed for every single record of input. A missing action is equivalent to

{ print }

which prints the entire record.

Comments begin with the ``#'' character, and continue until the end of the line. Blank lines may be used to separate statements. Normally, a statement ends with a newline, however, this is not the case for lines ending in a ``,'', {, ?, :, &&, or ||. Lines ending in do or else also have their statements automatically continued on the following line. In other cases, a line can be continued by ending it with a ``\'', in which case the newline will be ignored.

Multiple statements may be put on one line by separating them with a ``;''. This applies to both the statements within the action part of a pattern-action pair (the usual case), and to the pattern-action statements themselves.  

Patterns

AWK patterns may be one of the following:

BEGIN
END
/regular expression/
relational expression
pattern && pattern
pattern || pattern
pattern ? pattern : pattern
(pattern)
! pattern
pattern1, pattern2

BEGIN and END are two special kinds of patterns which are not tested against the input. The action parts of all BEGIN patterns are merged as if all the statements had been written in a single BEGIN block. They are executed before any of the input is read. Similarly, all the END blocks are merged, and executed when all the input is exhausted (or when an exit statement is executed). BEGIN and END patterns cannot be combined with other patterns in pattern expressions. BEGIN and END patterns cannot have missing action parts.

For /regular expression/ patterns, the associated statement is executed for each input record that matches the regular expression. Regular expressions are the same as those in egrep(1), and are summarized below.

A relational expression may use any of the operators defined below in the section on actions. These generally test whether certain fields match certain regular expressions.

The &&, ||, and ! operators are logical AND, logical OR, and logical NOT, respectively, as in C. They do short-circuit evaluation, also as in C, and are used for combining more primitive pattern expressions. As in most languages, parentheses may be used to change the order of evaluation.

The ?: operator is like the same operator in C. If the first pattern is true then the pattern used for testing is the second pattern, otherwise it is the third. Only one of the second and third patterns is evaluated.

The pattern1, pattern2 form of an expression is called a range pattern. It matches all input records starting with a record that matches pattern1, and continuing until a record that matches pattern2, inclusive. It does not combine with any other sort of pattern expression.  

Regular Expressions

Regular expressions are the extended kind found in egrep. They are composed of characters as follows:
c
matches the non-metacharacter c.
\c
matches the literal character c.
.
matches any character including newline.
^
matches the beginning of a string.
$
matches the end of a string.
[abc...]
character list, matches any of the characters abc....
[^abc...]
negated character list, matches any character except abc....
r1|r2
alternation: matches either r1 or r2.
r1r2
concatenation: matches r1, and then r2.
r+
matches one or more r's.
r*
matches zero or more r's.
r?
matches zero or one r's.
(r)
grouping: matches r.
r{n}
r{n,}
r{n,m} One or two numbers inside braces denote an interval expression. If there is one number in the braces, the preceding regular expression r is repeated n times. If there are two numbers separated by a comma, r is repeated n to m times. If there is one number followed by a comma, then r is repeated at least n times.

Interval expressions are only available if either --posix or --re-interval is specified on the command line.

\y
matches the empty string at either the beginning or the end of a word.
\B
matches the empty string within a word.
\<
matches the empty string at the beginning of a word.
\>
matches the empty string at the end of a word.
\w
matches any word-constituent character (letter, digit, or underscore).
\W
matches any character that is not word-constituent.
\`
matches the empty string at the beginning of a buffer (string).
\'
matches the empty string at the end of a buffer.

The escape sequences that are valid in string constants (see below) are also valid in regular expressions.

Character classes are a new feature introduced in the POSIX standard. A character class is a special notation for describing lists of characters that have a specific attribute, but where the actual characters themselves can vary from country to country and/or from character set to character set. For example, the notion of what is an alphabetic character differs in the USA and in France.

A character class is only valid in a regular expression inside the brackets of a character list. Character classes consist of [:, a keyword denoting the class, and :]. The character classes defined by the POSIX standard are:

[:alnum:]
Alphanumeric characters.
[:alpha:]
Alphabetic characters.
[:blank:]
Space or tab characters.
[:cntrl:]
Control characters.
[:digit:]
Numeric characters.
[:graph:]
Characters that are both printable and visible. (A space is printable, but not visible, while an a is both.)
[:lower:]
Lower-case alphabetic characters.
[:print:]
Printable characters (characters that are not control characters.)
[:punct:]
Punctuation characters (characters that are not letter, digits, control characters, or space characters).
[:space:]
Space characters (such as space, tab, and formfeed, to name a few).
[:upper:]
Upper-case alphabetic characters.
[:xdigit:]
Characters that are hexadecimal digits.

For example, before the POSIX standard, to match alphanumeric characters, you would have had to write /[A-Za-z0-9]/. If your character set had other alphabetic characters in it, this would not match them, and if your character set collated differently from ASCII, this might not even match the ASCII alphanumeric characters. With the POSIX character classes, you can write /[[:alnum:]]/, and this matches the alphabetic and numeric characters in your character set.

Two additional special sequences can appear in character lists. These apply to non-ASCII character sets, which can have single symbols (called collating elements) that are represented with more than one character, as well as several characters that are equivalent for collating, or sorting, purposes. (E.g., in French, a plain ``e'' and a grave-accented e` are equivalent.)

Collating Symbols
A collating symbol is a multi-character collating element enclosed in [. and .]. For example, if ch is a collating element, then [[.ch.]] is a regular expression that matches this collating element, while [ch] is a regular expression that matches either c or h.
Equivalence Classes
An equivalence class is a locale-specific name for a list of characters that are equivalent. The name is enclosed in [= and =]. For example, the name e might be used to represent all of ``e,'' ``e','' and ``e`.'' In this case, [[=e=]] is a regular expression that matches any of e, e', or e`.

These features are very valuable in non-English speaking locales. The library functions that gawk uses for regular expression matching currently only recognize POSIX character classes; they do not recognize collating symbols or equivalence classes.

The \y, \B, \<, \>, \w, \W, \`, and \' operators are specific to gawk; they are extensions based on facilities in the GNU regular expression libraries.

The various command line options control how gawk interprets characters in regular expressions.

No options
In the default case, gawk provide all the facilities of POSIX regular expressions and the GNU regular expression operators described above. However, interval expressions are not supported.
--posix
Only POSIX regular expressions are supported, the GNU operators are not special. (E.g., \w matches a literal w). Interval expressions are allowed.
--traditional
Traditional Unix awk regular expressions are matched. The GNU operators are not special, interval expressions are not available, and neither are the POSIX character classes ([[:alnum:]] and so on). Characters described by octal and hexadecimal escape sequences are treated literally, even if they represent regular expression metacharacters.
--re-interval
Allow interval expressions in regular expressions, even if --traditional has been provided.
 

Actions

Action statements are enclosed in braces, { and }. Action statements consist of the usual assignment, conditional, and looping statements found in most languages. The operators, control statements, and input/output statements available are patterned after those in C.  

Operators

The operators in AWK, in order of decreasing precedence, are

(...)
Grouping
$
Field reference.
++ --
Increment and decrement, both prefix and postfix.
^
Exponentiation (** may also be used, and **= for the assignment operator).
+ - !
Unary plus, unary minus, and logical negation.
* / %
Multiplication, division, and modulus.
+ -
Addition and subtraction.
space
String concatenation.
< >
<= >=
!= == The regular relational operators.
~ !~
Regular expression match, negated match. NOTE: Do not use a constant regular expression (/foo/) on the left-hand side of a ~ or !~. Only use one on the right-hand side. The expression /foo/ ~ exp has the same meaning as (($0 ~ /foo/) ~ exp). This is usually not what was intended.
in
Array membership.
&&
Logical AND.
||
Logical OR.
?:
The C conditional expression. This has the form expr1 ? expr2 : expr3. If expr1 is true, the value of the expression is expr2, otherwise it is expr3. Only one of expr2 and expr3 is evaluated.
= += -=
*= /= %= ^= Assignment. Both absolute assignment (var = value) and operator-assignment (the other forms) are supported.
 

Control Statements

The control statements are as follows:

if (condition) statement [ else statement ]
while (condition) statement 
do statement while (condition)
for (expr1; expr2; expr3) statement
for (var in array) statement
break
continue
delete array[index]
delete array
exit [ expression ]
{ statements }
 

I/O Statements

The input/output statements are as follows:

close(file [, how])
Close file, pipe or co-process. The optional how should only be used when closing one end of a two-way pipe to a co-process. It must be a string value, either "to" or "from".
getline
Set $0 from next input record; set NF, NR, FNR.
getline <file
Set $0 from next record of file; set NF.
getline var
Set var from next input record; set NR, FNR.
getline var <file
Set var from next record of file.
command | getline [var]
Run command piping the output either into $0 or var, as above.
command |& getline [var]
Run command as a co-process piping the output either into $0 or var, as above. Co-processes are a gawk extension.
next
Stop processing the current input record. The next input record is read and processing starts over with the first pattern in the AWK program. If the end of the input data is reached, the END block(s), if any, are executed.
nextfile
Stop processing the current input file. The next input record read comes from the next input file. FILENAME and ARGIND are updated, FNR is reset to 1, and processing starts over with the first pattern in the AWK program. If the end of the input data is reached, the END block(s), if any, are executed.
print
Prints the current record. The output record is terminated with the value of the ORS variable.
print expr-list
Prints expressions. Each expression is separated by the value of the OFS variable. The output record is terminated with the value of the ORS variable.
print expr-list >file
Prints expressions on file. Each expression is separated by the value of the OFS variable. The output record is terminated with the value of the ORS variable.
printf fmt, expr-list
Format and print.
printf fmt, expr-list >file
Format and print on file.
system(cmd-line)
Execute the command cmd-line, and return the exit status. (This may not be available on non-POSIX systems.)
fflush([file])
Flush any buffers associated with the open output file or pipe file. If file is missing, then standard output is flushed. If file is the null string, then all open output files and pipes have their buffers flushed.

Additional output redirections are allowed for print and printf.

print ... >> file
appends output to the file.
print ... | command
writes on a pipe.
print ... |& command
sends data to a co-process.

The getline command returns 0 on end of file and -1 on an error. Upon an error, ERRNO contains a string describing the problem.

NOTE: If using a pipe or co-process to getline, or from print or printf within a loop, you must use close() to create new instances of the command. AWK does not automatically close pipes or co-processes when they return EOF.  

The printf Statement

The AWK versions of the printf statement and sprintf() function (see below) accept the following conversion specification formats:

%c
An ASCII character. If the argument used for %c is numeric, it is treated as a character and printed. Otherwise, the argument is assumed to be a string, and the only first character of that string is printed.
%d, %i
A decimal number (the integer part).
%e , %E
A floating point number of the form [-]d.dddddde[+-]dd. The %E format uses E instead of e.
%f
A floating point number of the form [-]ddd.dddddd.
%g , %G
Use %e or %f conversion, whichever is shorter, with nonsignificant zeros suppressed. The %G format uses %E instead of %e.
%o
An unsigned octal number (also an integer).
%u An unsigned decimal number (again, an integer).
%s
A character string.
%x , %X
An unsigned hexadecimal number (an integer). The %X format uses ABCDEF instead of abcdef.
%%
A single % character; no argument is converted.

NOTE: When using the integer format-control letters for values that are outside the range of a C long integer, gawk switches to the %g format specifier. If --lint is provided on the command line gawk warns about this. Other versions of awk may print invalid values or do something else entirely.

Optional, additional parameters may lie between the % and the control letter:

count$
Use the count'th argument at this point in the formatting. This is called a positional specifier and is intended primarily for use in translated versions of format strings, not in the original text of an AWK program. It is a gawk extension.
-
The expression should be left-justified within its field.
space
For numeric conversions, prefix positive values with a space, and negative values with a minus sign.
+
The plus sign, used before the width modifier (see below), says to always supply a sign for numeric conversions, even if the data to be formatted is positive. The + overrides the space modifier.
#
Use an ``alternate form'' for certain control letters. For %o, supply a leading zero. For %x, and %X, supply a leading 0x or 0X for a nonzero result. For %e, %E, and %f, the result always contains a decimal point. For %g, and %G, trailing zeros are not removed from the result.
0
A leading 0 (zero) acts as a flag, that indicates output should be padded with zeroes instead of spaces. This applies even to non-numeric output formats. This flag only has an effect when the field width is wider than the value to be printed.
width
The field should be padded to this width. The field is normally padded with spaces. If the 0 flag has been used, it is padded with zeroes.
.prec
A number that specifies the precision to use when printing. For the %e, %E, and %f formats, this specifies the number of digits you want printed to the right of the decimal point. For the %g, and %G formats, it specifies the maximum number of significant digits. For the %d, %o, %i, %u, %x, and %X formats, it specifies the minimum number of digits to print. For %s, it specifies the maximum number of characters from the string that should be printed.

The dynamic width and prec capabilities of the ANSI C printf() routines are supported. A * in place of either the width or prec specifications causes their values to be taken from the argument list to printf or sprintf(). To use a positional specifier with a dynamic width or precision, supply the count$ after the * in the format string. For example, "%3$*2$.*1$s".  

Special File Names

When doing I/O redirection from either print or printf into a file, or via getline from a file, gawk recognizes certain special filenames internally. These filenames allow access to open file descriptors inherited from gawk's parent process (usually the shell). These file names may also be used on the command line to name data files. The filenames are:

/dev/stdin
The standard input.
/dev/stdout
The standard output.
/dev/stderr
The standard error output.
/dev/fd/n
The file associated with the open file descriptor n.

These are particularly useful for error messages. For example:

print "You blew it!" > "/dev/stderr"

whereas you would otherwise have to use

print "You blew it!" | "cat 1>&2"

The following special filenames may be used with the |& co-process operator for creating TCP/IP network connections.

/inet/tcp/lport/rhost/rport
File for TCP/IP connection on local port lport to remote host rhost on remote port rport. Use a port of 0 to have the system pick a port.
/inet/udp/lport/rhost/rport
Similar, but use UDP/IP instead of TCP/IP.
/inet/raw/lport/rhost/rport
Reserved for future use.

Other special filenames provide access to information about the running gawk process. These filenames are now obsolete. Use the PROCINFO array to obtain the information they provide. The filenames are:

/dev/pid
Reading this file returns the process ID of the current process, in decimal, terminated with a newline.
/dev/ppid
Reading this file returns the parent process ID of the current process, in decimal, terminated with a newline.
/dev/pgrpid
Reading this file returns the process group ID of the current process, in decimal, terminated with a newline.
/dev/user
Reading this file returns a single record terminated with a newline. The fields are separated with spaces. $1 is the value of the getuid(2) system call, $2 is the value of the geteuid(2) system call, $3 is the value of the getgid(2) system call, and $4 is the value of the getegid(2) system call. If there are any additional fields, they are the group IDs returned by getgroups(2). Multiple groups may not be supported on all systems.
 

Numeric Functions

AWK has the following built-in arithmetic functions:

atan2(y, x)
Returns the arctangent of y/x in radians.
cos(expr)
Returns the cosine of expr, which is in radians.
exp(expr)
The exponential function.
int(expr)
Truncates to integer.
log(expr)
The natural logarithm function.
rand()
Returns a random number N, between 0 and 1, such that 0 < N < 1.
sin(expr)
Returns the sine of expr, which is in radians.
sqrt(expr)
The square root function.
srand([expr])
Uses expr as a new seed for the random number generator. If no expr is provided, the time of day is used. The return value is the previous seed for the random number generator.
 

String Functions

Gawk has the following built-in string functions:

asort(s [, d])
Returns the number of elements in the source array s. The contents of s are sorted using gawk's normal rules for comparing values, and the indexes of the sorted values of s are replaced with sequential integers starting with 1. If the optional destination array d is specified, then s is first duplicated into d, and then d is sorted, leaving the indexes of the source array s unchanged.
asorti(s [, d])
Returns the number of elements in the source array s. The behavior is the same as that of asort(), except that the array indices are used for sorting, not the array values. When done, the array is indexed numerically, and the values are those of the original indices. The original values are lost; thus provide a second array if you wish to preserve the original.
gensub(r, s, h [, t])
Search the target string t for matches of the regular expression r. If h is a string beginning with g or G, then replace all matches of r with s. Otherwise, h is a number indicating which match of r to replace. If t is not supplied, $0 is used instead. Within the replacement text s, the sequence \n, where n is a digit from 1 to 9, may be used to indicate just the text that matched the n'th parenthesized subexpression. The sequence \0 represents the entire matched text, as does the character &. Unlike sub() and gsub(), the modified string is returned as the result of the function, and the original target string is not changed.
gsub(r, s [, t])
For each substring matching the regular expression r in the string t, substitute the string s, and return the number of substitutions. If t is not supplied, use $0. An & in the replacement text is replaced with the text that was actually matched. Use \& to get a literal &. (This must be typed as "\\&"; see GAWK: Effective AWK Programming for a fuller discussion of the rules for &'s and backslashes in the replacement text of sub(), gsub(), and gensub().)
index(s, t)
Returns the index of the string t in the string s, or 0 if t is not present. (This implies that character indices start at one.)
length([s])
Returns the length of the string s, or the length of $0 if s is not supplied. Starting with version 3.1.5, as a non-standard extension, with an array argument, length() returns the number of elements in the array.
match(s, r [, a])
Returns the position in s where the regular expression r occurs, or 0 if r is not present, and sets the values of RSTART and RLENGTH. Note that the argument order is the same as for the ~ operator: str ~ re. If array a is provided, a is cleared and then elements 1 through n are filled with the portions of s that match the corresponding parenthesized subexpression in r. The 0'th element of a contains the portion of s matched by the entire regular expression r. Subscripts a[n, "start"], and a[n, "length"] provide the starting index in the string and length respectively, of each matching substring.
split(s, a [, r])
Splits the string s into the array a on the regular expression r, and returns the number of fields. If r is omitted, FS is used instead. The array a is cleared first. Splitting behaves identically to field splitting, described above.
sprintf(fmt, expr-list)
Prints expr-list according to fmt, and returns the resulting string.
strtonum(str)
Examines str, and returns its numeric value. If str begins with a leading 0, strtonum() assumes that str is an octal number. If str begins with a leading 0x or 0X, strtonum() assumes that str is a hexadecimal number.
sub(r, s [, t])
Just like gsub(), but only the first matching substring is replaced.
substr(s, i [, n])
Returns the at most n-character substring of s starting at i. If n is omitted, the rest of s is used.
tolower(str)
Returns a copy of the string str, with all the upper-case characters in str translated to their corresponding lower-case counterparts. Non-alphabetic characters are left unchanged.
toupper(str)
Returns a copy of the string str, with all the lower-case characters in str translated to their corresponding upper-case counterparts. Non-alphabetic characters are left unchanged.
 

Time Functions

Since one of the primary uses of AWK programs is processing log files that contain time stamp information, gawk provides the following functions for obtaining time stamps and formatting them.

mktime(datespec)
Turns datespec into a time stamp of the same form as returned by systime(). The datespec is a string of the form YYYY MM DD HH MM SS[ DST]. The contents of the string are six or seven numbers representing respectively the full year including century, the month from 1 to 12, the day of the month from 1 to 31, the hour of the day from 0 to 23, the minute from 0 to 59, and the second from 0 to 60, and an optional daylight saving flag. The values of these numbers need not be within the ranges specified; for example, an hour of -1 means 1 hour before midnight. The origin-zero Gregorian calendar is assumed, with year 0 preceding year 1 and year -1 preceding year 0. The time is assumed to be in the local timezone. If the daylight saving flag is positive, the time is assumed to be daylight saving time; if zero, the time is assumed to be standard time; and if negative (the default), mktime() attempts to determine whether daylight saving time is in effect for the specified time. If datespec does not contain enough elements or if the resulting time is out of range, mktime() returns -1.
strftime([format [, timestamp]])
Formats timestamp according to the specification in format. The timestamp should be of the same form as returned by systime(). If timestamp is missing, the current time of day is used. If format is missing, a default format equivalent to the output of date(1) is used. See the specification for the strftime() function in ANSI C for the format conversions that are guaranteed to be available. A public-domain version of strftime(3) and a man page for it come with gawk; if that version was used to build gawk, then all of the conversions described in that man page are available to gawk.
systime()
Returns the current time of day as the number of seconds since the Epoch (1970-01-01 00:00:00 UTC on POSIX systems).
 

Bit Manipulations Functions

Starting with version 3.1 of gawk, the following bit manipulation functions are available. They work by converting double-precision floating point values to unsigned long integers, doing the operation, and then converting the result back to floating point. The functions are:
and(v1, v2)
Return the bitwise AND of the values provided by v1 and v2.
compl(val)
Return the bitwise complement of val.
lshift(val, count)
Return the value of val, shifted left by count bits.
or(v1, v2)
Return the bitwise OR of the values provided by v1 and v2.
rshift(val, count)
Return the value of val, shifted right by count bits.
xor(v1, v2)
Return the bitwise XOR of the values provided by v1 and v2.

 

Internationalization Functions

Starting with version 3.1 of gawk, the following functions may be used from within your AWK program for translating strings at run-time. For full details, see GAWK: Effective AWK Programming.
bindtextdomain(directory [, domain])
Specifies the directory where gawk looks for the .mo files, in case they will not or cannot be placed in the ``standard'' locations (e.g., during testing). It returns the directory where domain is ``bound.''

The default domain is the value of TEXTDOMAIN. If directory is the null string (""), then bindtextdomain() returns the current binding for the given domain.

dcgettext(string [, domain [, category]])
Returns the translation of string in text domain domain for locale category category. The default value for domain is the current value of TEXTDOMAIN. The default value for category is "LC_MESSAGES".

If you supply a value for category, it must be a string equal to one of the known locale categories described in GAWK: Effective AWK Programming. You must also supply a text domain. Use TEXTDOMAIN if you want to use the current domain.

dcngettext(string1 , string2 , number [, domain [, category]])
Returns the plural form used for number of the translation of string1 and string2 in text domain domain for locale category category. The default value for domain is the current value of TEXTDOMAIN. The default value for category is "LC_MESSAGES".

If you supply a value for category, it must be a string equal to one of the known locale categories described in GAWK: Effective AWK Programming. You must also supply a text domain. Use TEXTDOMAIN if you want to use the current domain.

 

USER-DEFINED FUNCTIONS

Functions in AWK are defined as follows:

function name(parameter list) { statements }

Functions are executed when they are called from within expressions in either patterns or actions. Actual parameters supplied in the function call are used to instantiate the formal parameters declared in the function. Arrays are passed by reference, other variables are passed by value.

Since functions were not originally part of the AWK language, the provision for local variables is rather clumsy: They are declared as extra parameters in the parameter list. The convention is to separate local variables from real parameters by extra spaces in the parameter list. For example:

function  f(p, q,     a, b)     # a and b are local
{
        ...
}

/abc/   { ... ; f(1, 2) ; ... }

The left parenthesis in a function call is required to immediately follow the function name, without any intervening white space. This is to avoid a syntactic ambiguity with the concatenation operator. This restriction does not apply to the built-in functions listed above.

Functions may call each other and may be recursive. Function parameters used as local variables are initialized to the null string and the number zero upon function invocation.

Use return expr to return a value from a function. The return value is undefined if no value is provided, or if the function returns by ``falling off'' the end.

If --lint has been provided, gawk warns about calls to undefined functions at parse time, instead of at run time. Calling an undefined function at run time is a fatal error.

The word func may be used in place of function.  

DYNAMICALLY LOADING NEW FUNCTIONS

Beginning with version 3.1 of gawk, you can dynamically add new built-in functions to the running gawk interpreter. The full details are beyond the scope of this manual page; see GAWK: Effective AWK Programming for the details.

extension(object, function)
Dynamically link the shared object file named by object, and invoke function in that object, to perform initialization. These should both be provided as strings. Returns the value returned by function.

This function is provided and documented in GAWK: Effective AWK Programming, but everything about this feature is likely to change in the next release. We STRONGLY recommend that you do not use this feature for anything that you aren't willing to redo.  

SIGNALS

pgawk accepts two signals. SIGUSR1 causes it to dump a profile and function call stack to the profile file, which is either awkprof.out, or whatever file was named with the --profile option. It then continues to run. SIGHUP causes it to dump the profile and function call stack and then exit.  

EXAMPLES

Print and sort the login names of all users:

        BEGIN   { FS = ":" }
                { print $1 | "sort" }

Count lines in a file:

                { nlines++ }
        END     { print nlines }

Precede each line by its number in the file:

        { print FNR, $0 }

Concatenate and line number (a variation on a theme):

        { print NR, $0 }
Run an external command for particular lines of data:

        tail -f access_log |
        awk '/myhome.html/ { system("nmap " $1 ">> logdir/myhome.html") }'
 

INTERNATIONALIZATION

String constants are sequences of characters enclosed in double quotes. In non-English speaking environments, it is possible to mark strings in the AWK program as requiring translation to the native natural language. Such strings are marked in the AWK program with a leading underscore (``_''). For example,

gawk 'BEGIN { print "hello, world" }'

always prints hello, world. But,

gawk 'BEGIN { print _"hello, world" }'

might print bonjour, monde in France.

There are several steps involved in producing and running a localizable AWK program.

1.
Add a BEGIN action to assign a value to the TEXTDOMAIN variable to set the text domain to a name associated with your program.


      BEGIN { TEXTDOMAIN = "myprog" }

This allows gawk to find the .mo file associated with your program. Without this step, gawk uses the messages text domain, which likely does not contain translations for your program.

2.
Mark all strings that should be translated with leading underscores.
3.
If necessary, use the dcgettext() and/or bindtextdomain() functions in your program, as appropriate.
4.
Run gawk --gen-po -f myprog.awk > myprog.po to generate a .po file for your program.
5.
Provide appropriate translations, and build and install a corresponding .mo file.

The internationalization features are described in full detail in GAWK: Effective AWK Programming.  

POSIX COMPATIBILITY

A primary goal for gawk is compatibility with the POSIX standard, as well as with the latest version of UNIX awk. To this end, gawk incorporates the following user visible features which are not described in the AWK book, but are part of the Bell Laboratories version of awk, and are in the POSIX standard.

The book indicates that command line variable assignment happens when awk would otherwise open the argument as a file, which is after the BEGIN block is executed. However, in earlier implementations, when such an assignment appeared before any file names, the assignment would happen before the BEGIN block was run. Applications came to depend on this ``feature.'' When awk was changed to match its documentation, the -v option for assigning variables before program execution was added to accommodate applications that depended upon the old behavior. (This feature was agreed upon by both the Bell Laboratories and the GNU developers.)

The -W option for implementation specific features is from the POSIX standard.

When processing arguments, gawk uses the special option ``--'' to signal the end of arguments. In compatibility mode, it warns about but otherwise ignores undefined options. In normal operation, such arguments are passed on to the AWK program for it to process.

The AWK book does not define the return value of srand(). The POSIX standard has it return the seed it was using, to allow keeping track of random number sequences. Therefore srand() in gawk also returns its current seed.

Other new features are: The use of multiple -f options (from MKS awk); the ENVIRON array; the \a, and \v escape sequences (done originally in gawk and fed back into the Bell Laboratories version); the tolower() and toupper() built-in functions (from the Bell Laboratories version); and the ANSI C conversion specifications in printf (done first in the Bell Laboratories version).  

HISTORICAL FEATURES

There are two features of historical AWK implementations that gawk supports. First, it is possible to call the length() built-in function not only with no argument, but even without parentheses! Thus,

a = length    # Holy Algol 60, Batman!

is the same as either of

a = length()
a = length($0)

This feature is marked as ``deprecated'' in the POSIX standard, and gawk issues a warning about its use if --lint is specified on the command line.

The other feature is the use of either the continue or the break statements outside the body of a while, for, or do loop. Traditional AWK implementations have treated such usage as equivalent to the next statement. Gawk supports this usage if --traditional has been specified.  

GNU EXTENSIONS

Gawk has a number of extensions to POSIX awk. They are described in this section. All the extensions described here can be disabled by invoking gawk with the --traditional option.

The following features of gawk are not available in POSIX awk.

*
No path search is performed for files named via the -f option. Therefore the AWKPATH environment variable is not special.
*
The \x escape sequence. (Disabled with --posix.)
*
The fflush() function. (Disabled with --posix.)
*
The ability to continue lines after ? and :. (Disabled with --posix.)
*
Octal and hexadecimal constants in AWK programs.
*
The ARGIND, BINMODE, ERRNO, LINT, RT and TEXTDOMAIN variables are not special.
*
The IGNORECASE variable and its side-effects are not available.
*
The FIELDWIDTHS variable and fixed-width field splitting.
*
The PROCINFO array is not available.
*
The use of RS as a regular expression.
*
The special file names available for I/O redirection are not recognized.
*
The |& operator for creating co-processes.
*
The ability to split out individual characters using the null string as the value of FS, and as the third argument to split().
*
The optional second argument to the close() function.
*
The optional third argument to the match() function.
*
The ability to use positional specifiers with printf and sprintf().
*
The use of delete array to delete the entire contents of an array.
*
The use of nextfile to abandon processing of the current input file.
*
The and(), asort(), asorti(), bindtextdomain(), compl(), dcgettext(), dcngettext(), gensub(), lshift(), mktime(), or(), rshift(), strftime(), strtonum(), systime() and xor() functions.
*
Localizable strings.
*
Adding new built-in functions dynamically with the extension() function.

The AWK book does not define the return value of the close() function. Gawk's close() returns the value from fclose(3), or pclose(3), when closing an output file or pipe, respectively. It returns the process's exit status when closing an input pipe. The return value is -1 if the named file, pipe or co-process was not opened with a redirection.

When gawk is invoked with the --traditional option, if the fs argument to the -F option is ``t'', then FS is set to the tab character. Note that typing gawk -F\t ... simply causes the shell to quote the ``t,'', and does not pass ``\t'' to the -F option. Since this is a rather ugly special case, it is not the default behavior. This behavior also does not occur if --posix has been specified. To really get a tab character as the field separator, it is best to use single quotes: gawk -F'\t' ....

If gawk is configured with the --enable-switch option to the configure command, then it accepts an additional control-flow statement:

switch (expression) {
case value|regex : statement
...
[ default: statement ]
}
 

ENVIRONMENT VARIABLES

The AWKPATH environment variable can be used to provide a list of directories that gawk searches when looking for files named via the -f and --file options.

If POSIXLY_CORRECT exists in the environment, then gawk behaves exactly as if --posix had been specified on the command line. If --lint has been specified, gawk issues a warning message to this effect.  

SEE ALSO

egrep(1), getpid(2), getppid(2), getpgrp(2), getuid(2), geteuid(2), getgid(2), getegid(2), getgroups(2)

The AWK Programming Language, Alfred V. Aho, Brian W. Kernighan, Peter J. Weinberger, Addison-Wesley, 1988. ISBN 0-201-07981-X.

GAWK: Effective AWK Programming, Edition 3.0, published by the Free Software Foundation, 2001.  

BUGS

The -F option is not necessary given the command line variable assignment feature; it remains only for backwards compatibility.

Syntactically invalid single character programs tend to overflow the parse stack, generating a rather unhelpful message. Such programs are surprisingly difficult to diagnose in the completely general case, and the effort to do so really is not worth it.  

AUTHORS

The original version of UNIX awk was designed and implemented by Alfred Aho, Peter Weinberger, and Brian Kernighan of Bell Laboratories. Brian Kernighan continues to maintain and enhance it.

Paul Rubin and Jay Fenlason, of the Free Software Foundation, wrote gawk, to be compatible with the original version of awk distributed in Seventh Edition UNIX. John Woods contributed a number of bug fixes. David Trueman, with contributions from Arnold Robbins, made gawk compatible with the new version of UNIX awk. Arnold Robbins is the current maintainer.

The initial DOS port was done by Conrad Kwok and Scott Garfinkle. Scott Deifik is the current DOS maintainer. Pat Rankin did the port to VMS, and Michal Jaegermann did the port to the Atari ST. The port to OS/2 was done by Kai Uwe Rommel, with contributions and help from Darrel Hankerson. Fred Fish supplied support for the Amiga, Stephen Davies provided the Tandem port, and Martin Brown provided the BeOS port.  

VERSION INFORMATION

This man page documents gawk, version 3.1.5.  

BUG REPORTS

If you find a bug in gawk, please send electronic mail to bug-gawk@gnu.org. Please include your operating system and its revision, the version of gawk (from gawk --version), what C compiler you used to compile it, and a test program and data that are as small as possible for reproducing the problem.

Before sending a bug report, please do two things. First, verify that you have the latest version of gawk. Many bugs (usually subtle ones) are fixed at each release, and if yours is out of date, the problem may already have been solved. Second, please read this man page and the reference manual carefully to be sure that what you think is a bug really is, instead of just a quirk in the language.

Whatever you do, do NOT post a bug report in comp.lang.awk. While the gawk developers occasionally read this newsgroup, posting bug reports there is an unreliable way to report bugs. Instead, please use the electronic mail addresses given above.

If you're using a GNU/Linux system or BSD-based system, you may wish to submit a bug report to the vendor of your distribution. That's fine, but please send a copy to the official email address as well, since there's no guarantee that the bug will be forwarded to the gawk maintainer.  

ACKNOWLEDGEMENTS

Brian Kernighan of Bell Laboratories provided valuable assistance during testing and debugging. We thank him.  

COPYING PERMISSIONS

Copyright © 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.

Permission is granted to make and distribute verbatim copies of this manual page provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual page under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Foundation.


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTION FORMAT
OPTIONS
AWK PROGRAM EXECUTION
VARIABLES, RECORDS AND FIELDS
Records
Fields
Built-in Variables
Arrays
Variable Typing And Conversion
Octal and Hexadecimal Constants
String Constants
PATTERNS AND ACTIONS
Patterns
Regular Expressions
Actions
Operators
Control Statements
I/O Statements
The printf Statement
Special File Names
Numeric Functions
String Functions
Time Functions
Bit Manipulations Functions
Internationalization Functions
USER-DEFINED FUNCTIONS
DYNAMICALLY LOADING NEW FUNCTIONS
SIGNALS
EXAMPLES
INTERNATIONALIZATION
POSIX COMPATIBILITY
HISTORICAL FEATURES
GNU EXTENSIONS
ENVIRONMENT VARIABLES
SEE ALSO
BUGS
AUTHORS
VERSION INFORMATION
BUG REPORTS
ACKNOWLEDGEMENTS
COPYING PERMISSIONS

This document was created by man2html, using the manual pages.
Time: 01:58:52 GMT, May 26, 2008

Man Bash

The Bash Man Page

Manpage of BASH

BASH

Section: User Commands (1)
Updated: 2005 Dec 28
Index Return to Main Contents
 

NAME

bash - GNU Bourne-Again SHell  

SYNOPSIS

bash [options] [file]  

COPYRIGHT

Bash is Copyright (C) 1989-2005 by the Free Software Foundation, Inc.  

DESCRIPTION

Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file. Bash also incorporates useful features from the Korn and C shells (ksh and csh).

Bash is intended to be a conformant implementation of the IEEE POSIX Shell and Tools specification (IEEE Working Group 1003.2). Bash can be configured to be POSIX-conformant by default.  

OPTIONS

In addition to the single-character shell options documented in the description of the set builtin command, bash interprets the following options when it is invoked:

-c string
If the -c option is present, then commands are read from string. If there are arguments after the string, they are assigned to the positional parameters, starting with $0.
-i
If the -i option is present, the shell is interactive.
-l
Make bash act as if it had been invoked as a login shell (see INVOCATION below).
-r
If the -r option is present, the shell becomes restricted (see RESTRICTED SHELL below).
-s
If the -s option is present, or if no arguments remain after option processing, then commands are read from the standard input. This option allows the positional parameters to be set when invoking an interactive shell.
-D
A list of all double-quoted strings preceded by $ is printed on the standard output. These are the strings that are subject to language translation when the current locale is not C or POSIX. This implies the -n option; no commands will be executed.
[-+]O [shopt_option]
shopt_option is one of the shell options accepted by the shopt builtin (see SHELL BUILTIN COMMANDS below). If shopt_option is present, -O sets the value of that option; +O unsets it. If shopt_option is not supplied, the names and values of the shell options accepted by shopt are printed on the standard output. If the invocation option is +O, the output is displayed in a format that may be reused as input.
--
A -- signals the end of options and disables further option processing. Any arguments after the -- are treated as filenames and arguments. An argument of - is equivalent to --.

Bash also interprets a number of multi-character options. These options must appear on the command line before the single-character options to be recognized.

--debugger
Arrange for the debugger profile to be executed before the shell starts. Turns on extended debugging mode (see the description of the extdebug option to the shopt builtin below) and shell function tracing (see the description of the -o functrace option to the set builtin below).
--dump-po-strings
Equivalent to -D, but the output is in the GNU gettext po (portable object) file format.
--dump-strings
Equivalent to -D.
--help
Display a usage message on standard output and exit successfully.
--init-file file
--rcfile file
Execute commands from file instead of the standard personal initialization file ~/.bashrc if the shell is interactive (see INVOCATION below).
--login
Equivalent to -l.
--noediting
Do not use the GNU readline library to read command lines when the shell is interactive.
--noprofile
Do not read either the system-wide startup file /etc/profile or any of the personal initialization files ~/.bash_profile, ~/.bash_login, or ~/.profile. By default, bash reads these files when it is invoked as a login shell (see INVOCATION below).
--norc
Do not read and execute the personal initialization file ~/.bashrc if the shell is interactive. This option is on by default if the shell is invoked as sh.
--posix
Change the behavior of bash where the default operation differs from the POSIX 1003.2 standard to match the standard (posix mode).
--restricted
The shell becomes restricted (see RESTRICTED SHELL below).
--rpm-requires
Produce the list of files that are required for the shell script to run. This implies '-n' and is subject to the same limitations as compile time error checking checking; Backticks, [] tests, and evals are not parsed so some dependencies may be missed.
--verbose
Equivalent to -v.
--version
Show version information for this instance of bash on the standard output and exit successfully.
 

ARGUMENTS

If arguments remain after option processing, and neither the -c nor the -s option has been supplied, the first argument is assumed to be the name of a file containing shell commands. If bash is invoked in this fashion, $0 is set to the name of the file, and the positional parameters are set to the remaining arguments. Bash reads and executes commands from this file, then exits. Bash's exit status is the exit status of the last command executed in the script. If no commands are executed, the exit status is 0. An attempt is first made to open the file in the current directory, and, if no file is found, then the shell searches the directories in PATH for the script.  

INVOCATION

A login shell is one whose first character of argument zero is a -, or one started with the --login option.

An interactive shell is one started without non-option arguments and without the -c option whose standard input and error are both connected to terminals (as determined by isatty(3)), or one started with the -i option. PS1 is set and $- includes i if bash is interactive, allowing a shell script or a startup file to test this state.

The following paragraphs describe how bash executes its startup files. If any of the files exist but cannot be read, bash reports an error. Tildes are expanded in file names as described below under Tilde Expansion in the EXPANSION section.

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.

When a login shell exits, bash reads and executes commands from the file ~/.bash_logout, if it exists.

When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file exists. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of ~/.bashrc.

When bash is started non-interactively, to run a shell script, for example, it looks for the variable BASH_ENV in the environment, expands its value if it appears there, and uses the expanded value as the name of a file to read and execute. Bash behaves as if the following command were executed:

if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi

but the value of the PATH variable is not used to search for the file name.

If bash is invoked with the name sh, it tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the POSIX standard as well. When invoked as an interactive login shell, or a non-interactive shell with the --login option, it first attempts to read and execute commands from /etc/profile and ~/.profile, in that order. The --noprofile option may be used to inhibit this behavior. When invoked as an interactive shell with the name sh, bash looks for the variable ENV, expands its value if it is defined, and uses the expanded value as the name of a file to read and execute. Since a shell invoked as sh does not attempt to read and execute commands from any other startup files, the --rcfile option has no effect. A non-interactive shell invoked with the name sh does not attempt to read any other startup files. When invoked as sh, bash enters posix mode after the startup files are read.

When bash is started in posix mode, as with the --posix command line option, it follows the POSIX standard for startup files. In this mode, interactive shells expand the ENV variable and commands are read and executed from the file whose name is the expanded value. No other startup files are read.

Bash attempts to determine when it is being run by the remote shell daemon, usually rshd. If bash determines it is being run by rshd, it reads and executes commands from ~/.bashrc, if that file exists and is readable. It will not do this if invoked as sh. The --norc option may be used to inhibit this behavior, and the --rcfile option may be used to force another file to be read, but rshd does not generally invoke the shell with those options or allow them to be specified.

If the shell is started with the effective user (group) id not equal to the real user (group) id, and the -p option is not supplied, no startup files are read, shell functions are not inherited from the environment, the SHELLOPTS variable, if it appears in the environment, is ignored, and the effective user id is set to the real user id. If the -p option is supplied at invocation, the startup behavior is the same, but the effective user id is not reset.  

DEFINITIONS

The following definitions are used throughout the rest of this document.

blank
A space or tab.
word
A sequence of characters considered as a single unit by the shell. Also known as a token.
name
A word consisting only of alphanumeric characters and underscores, and beginning with an alphabetic character or an underscore. Also referred to as an identifier.
metacharacter
A character that, when unquoted, separates words. One of the following:

| & ; ( ) < > space tab

control operator
A token that performs a control function. It is one of the following symbols:

|| & && ; ;; ( ) | <newline>

 

RESERVED WORDS

Reserved words are words that have a special meaning to the shell. The following words are recognized as reserved when unquoted and either the first word of a simple command (see SHELL GRAMMAR below) or the third word of a case or for command:

! case do done elif else esac fi for function if in select then until while { } time [[ ]]  

SHELL GRAMMAR

 

Simple Commands

A simple command is a sequence of optional variable assignments followed by blank-separated words and redirections, and terminated by a control operator. The first word specifies the command to be executed, and is passed as argument zero. The remaining words are passed as arguments to the invoked command.

The return value of a simple command is its exit status, or 128+n if the command is terminated by signal n.  

Pipelines

A pipeline is a sequence of one or more commands separated by the character |. The format for a pipeline is:

[time [-p]] [ ! ] command [ | command2 ... ]

The standard output of command is connected via a pipe to the standard input of command2. This connection is performed before any redirections specified by the command (see REDIRECTION below).

The return status of a pipeline is the exit status of the last command, unless the pipefail option is enabled. If pipefail is enabled, the pipeline's return status is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands exit successfully. If the reserved word ! precedes a pipeline, the exit status of that pipeline is the logical negation of the exit status as described above. The shell waits for all commands in the pipeline to terminate before returning a value.

If the time reserved word precedes a pipeline, the elapsed as well as user and system time consumed by its execution are reported when the pipeline terminates. The -p option changes the output format to that specified by POSIX. The TIMEFORMAT variable may be set to a format string that specifies how the timing information should be displayed; see the description of TIMEFORMAT under Shell Variables below.

Each command in a pipeline is executed as a separate process (i.e., in a subshell).  

Lists

A list is a sequence of one or more pipelines separated by one of the operators ;, &, &&, or ||, and optionally terminated by one of ;, &, or <newline>.

Of these list operators, && and || have equal precedence, followed by ; and &, which have equal precedence.

A sequence of one or more newlines may appear in a list instead of a semicolon to delimit commands.

If a command is terminated by the control operator &, the shell executes the command in the background in a subshell. The shell does not wait for the command to finish, and the return status is 0. Commands separated by a ; are executed sequentially; the shell waits for each command to terminate in turn. The return status is the exit status of the last command executed.

The control operators && and || denote AND lists and OR lists, respectively. An AND list has the form

command1 && command2

command2 is executed if, and only if, command1 returns an exit status of zero.

An OR list has the form

command1 || command2

command2 is executed if and only if command1 returns a non-zero exit status. The return status of AND and OR lists is the exit status of the last command executed in the list.  

Compound Commands

A compound command is one of the following:

(list)
list is executed in a subshell environment (see COMMAND EXECUTION ENVIRONMENT below). Variable assignments and builtin commands that affect the shell's environment do not remain in effect after the command completes. The return status is the exit status of list.
{ list; }
list is simply executed in the current shell environment. list must be terminated with a newline or semicolon. This is known as a group command. The return status is the exit status of list. Note that unlike the metacharacters ( and ), { and } are reserved words and must occur where a reserved word is permitted to be recognized. Since they do not cause a word break, they must be separated from list by whitespace.
((expression))
The expression is evaluated according to the rules described below under ARITHMETICEVALUATION. If the value of the expression is non-zero, the return status is 0; otherwise the return status is 1. This is exactly equivalent to let "expression".
[[ expression ]]
Return a status of 0 or 1 depending on the evaluation of the conditional expression expression. Expressions are composed of the primaries described below under CONDITIONALEXPRESSIONS. Word splitting and pathname expansion are not performed on the words between the [[ and ]]; tilde expansion, parameter and variable expansion, arithmetic expansion, command substitution, process substitution, and quote removal are performed. Conditional operators such as -f must be unquoted to be recognized as primaries.

When the == and != operators are used, the string to the right of the operator is considered a pattern and matched according to the rules described below under Pattern Matching. If the shell option nocasematch is enabled, the match is performed without regard to the case of alphabetic characters. The return value is 0 if the string matches (==) or does not match (!=) the pattern, and 1 otherwise. Any part of the pattern may be quoted to force it to be matched as a string.

An additional binary operator, =~, is available, with the same precedence as == and !=. When it is used, the string to the right of the operator is considered an extended regular expression and matched accordingly (as in regex(3)). The return value is 0 if the string matches the pattern, and 1 otherwise. If the regular expression is syntactically incorrect, the conditional expression's return value is 2. If the shell option nocasematch is enabled, the match is performed without regard to the case of alphabetic characters. Substrings matched by parenthesized subexpressions within the regular expression are saved in the array variable BASH_REMATCH. The element of BASH_REMATCH with index 0 is the portion of the string matching the entire regular expression. The element of BASH_REMATCH with index n is the portion of the string matching the nth parenthesized subexpression.

Expressions may be combined using the following operators, listed in decreasing order of precedence:

( expression )
Returns the value of expression. This may be used to override the normal precedence of operators.
! expression
True if expression is false.
expression1 && expression2
True if both expression1 and expression2 are true.
expression1 || expression2 True if either expression1 or expression2 is true.

The && and || operators do not evaluate expression2 if the value of expression1 is sufficient to determine the return value of the entire conditional expression.

for name [ in word ] ; do list ; done
The list of words following in is expanded, generating a list of items. The variable name is set to each element of this list in turn, and list is executed each time. If the in word is omitted, the for command executes list once for each positional parameter that is set (see PARAMETERS below). The return status is the exit status of the last command that executes. If the expansion of the items following in results in an empty list, no commands are executed, and the return status is 0.
for (( expr1 ; expr2 ; expr3 )) ; do list ; done
First, the arithmetic expression expr1 is evaluated according to the rules described below under ARITHMETICEVALUATION. The arithmetic expression expr2 is then evaluated repeatedly until it evaluates to zero. Each time expr2 evaluates to a non-zero value, list is executed and the arithmetic expression expr3 is evaluated. If any expression is omitted, it behaves as if it evaluates to 1. The return value is the exit status of the last command in list that is executed, or false if any of the expressions is invalid.
select name [ in word ] ; do list ; done
The list of words following in is expanded, generating a list of items. The set of expanded words is printed on the standard error, each preceded by a number. If the in word is omitted, the positional parameters are printed (see PARAMETERS below). The PS3 prompt is then displayed and a line read from the standard input. If the line consists of a number corresponding to one of the displayed words, then the value of name is set to that word. If the line is empty, the words and prompt are displayed again. If EOF is read, the command completes. Any other value read causes name to be set to null. The line read is saved in the variable REPLY. The list is executed after each selection until a break command is executed. The exit status of select is the exit status of the last command executed in list, or zero if no commands were executed.
case word in [ [(] pattern [ | pattern ]
A case command first expands word, and tries to match it against each pattern in turn, using the same matching rules as for pathname expansion (see Pathname Expansion below). The word is expanded using tilde expansion, parameter and variable expansion, arithmetic substituion, command substitution, process substitution and quote removal. Each pattern examined is expanded using tilde expansion, parameter and variable expansion, arithmetic substituion, command substitution, and process substitution. If the shell option nocasematch is enabled, the match is performed without regard to the case of alphabetic characters. When a match is found, the corresponding list is executed. After the first match, no subsequent matches are attempted. The exit status is zero if no pattern matches. Otherwise, it is the exit status of the last command executed in list.
if list; then list; [ elif list; then list; ] ... [ else list; ] fi
The if list is executed. If its exit status is zero, the then list is executed. Otherwise, each elif list is executed in turn, and if its exit status is zero, the corresponding then list is executed and the command completes. Otherwise, the else list is executed, if present. The exit status is the exit status of the last command executed, or zero if no condition tested true.
while list; do list; done
until list; do list; done
The while command continuously executes the do list as long as the last command in list returns an exit status of zero. The until command is identical to the while command, except that the test is negated; the do list is executed as long as the last command in list returns a non-zero exit status. The exit status of the while and until commands is the exit status of the last do list command executed, or zero if none was executed.
 

Shell Function Definitions

A shell function is an object that is called like a simple command and executes a compound command with a new set of positional parameters. Shell functions are declared as follows:

[ function ] name () compound-command [redirection]
This defines a function named name. The reserved word function is optional. If the function reserved word is supplied, the parentheses are optional. The body of the function is the compound command compound-command (see Compound Commands above). That command is usually a list of commands between { and }, but may be any command listed under Compound Commands above. compound-command is executed whenever name is specified as the name of a simple command. Any redirections (see REDIRECTION below) specified when a function is defined are performed when the function is executed. The exit status of a function definition is zero unless a syntax error occurs or a readonly function with the same name already exists. When executed, the exit status of a function is the exit status of the last command executed in the body. (See FUNCTIONS below.)
 

COMMENTS

In a non-interactive shell, or an interactive shell in which the interactive_comments option to the shopt builtin is enabled (see SHELL BUILTIN COMMANDS below), a word beginning with # causes that word and all remaining characters on that line to be ignored. An interactive shell without the interactive_comments option enabled does not allow comments. The interactive_comments option is on by default in interactive shells.  

QUOTING

Quoting is used to remove the special meaning of certain characters or words to the shell. Quoting can be used to disable special treatment for special characters, to prevent reserved words from being recognized as such, and to prevent parameter expansion.

Each of the metacharacters listed above under DEFINITIONS has special meaning to the shell and must be quoted if it is to represent itself.

When the command history expansion facilities are being used (see HISTORY EXPANSION below), the history expansion character, usually !, must be quoted to prevent history expansion.

There are three quoting mechanisms: the escape character, single quotes, and double quotes.

A non-quoted backslash (\) is the escape character. It preserves the literal value of the next character that follows, with the exception of <newline>. If a \<newline> pair appears, and the backslash is not itself quoted, the \<newline> is treated as a line continuation (that is, it is removed from the input stream and effectively ignored).

Enclosing characters in single quotes preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.

Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of $, `, \, and, when history expansion is enabled, !. The characters $ and ` retain their special meaning within double quotes. The backslash retains its special meaning only when followed by one of the following characters: $, `, ", \, or <newline>. A double quote may be quoted within double quotes by preceding it with a backslash. If enabled, history expansion will be performed unless an ! appearing in double quotes is escaped using a backslash. The backslash preceding the ! is not removed.

The special parameters * and @ have special meaning when in double quotes (see PARAMETERS below).

Words of the form $aqstringaq are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ANSI C standard. Backslash escape sequences, if present, are decoded as follows:

\a
alert (bell)
\b
backspace
\e
an escape character
\f
form feed
\n
new line
\r
carriage return
\t
horizontal tab
\v
vertical tab
\\
backslash
\aq
single quote
\nnn
the eight-bit character whose value is the octal value nnn (one to three digits)
\xHH
the eight-bit character whose value is the hexadecimal value HH (one or two hex digits)
\cx
a control-x character

The expanded result is single-quoted, as if the dollar sign had not been present.

A double-quoted string preceded by a dollar sign ($) will cause the string to be translated according to the current locale. If the current locale is C or POSIX, the dollar sign is ignored. If the string is translated and replaced, the replacement is double-quoted.  

PARAMETERS

A parameter is an entity that stores values. It can be a name, a number, or one of the special characters listed below under Special Parameters. A variable is a parameter denoted by a name. A variable has a value and zero or more attributes. Attributes are assigned using the declare builtin command (see declare below in SHELLBUILTINCOMMANDS).

A parameter is set if it has been assigned a value. The null string is a valid value. Once a variable is set, it may be unset only by using the unset builtin command (see SHELL BUILTIN COMMANDS below).

A variable may be assigned to by a statement of the form

name=[value]

If value is not given, the variable is assigned the null string. All values undergo tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, and quote removal (see EXPANSION below). If the variable has its integer attribute set, then value is evaluated as an arithmetic expression even if the $((...)) expansion is not used (see Arithmetic Expansion below). Word splitting is not performed, with the exception of "$@" as explained below under Special Parameters. Pathname expansion is not performed. Assignment statements may also appear as arguments to the alias, declare, typeset, export, readonly, and local builtin commands.

In the context where an assignment statement is assigning a value to a shell variable or array index, the += operator can be used to append to or add to the variable's previous value. When += is applied to a variable for which the integer attribute has been set, value is evaluated as an arithmetic expression and added to the variable's current value, which is also evaluated. When += is applied to an array variable using compound assignment (see Arrays below), the variable's value is not unset (as it is when using =), and new values are appended to the array beginning at one greater than the array's maximum index. When applied to a string-valued variable, value is expanded and appended to the variable's value.  

Positional Parameters

A positional parameter is a parameter denoted by one or more digits, other than the single digit 0. Positional parameters are assigned from the shell's arguments when it is invoked, and may be reassigned using the set builtin command. Positional parameters may not be assigned to with assignment statements. The positional parameters are temporarily replaced when a shell function is executed (see FUNCTIONS below).

When a positional parameter consisting of more than a single digit is expanded, it must be enclosed in braces (see EXPANSION below).  

Special Parameters

The shell treats several parameters specially. These parameters may only be referenced; assignment to them is not allowed.

*
Expands to the positional parameters, starting from one. When the expansion occurs within double quotes, it expands to a single word with the value of each parameter separated by the first character of the IFS special variable. That is, "$*" is equivalent to "$1c$2c...", where c is the first character of the value of the IFS variable. If IFS is unset, the parameters are separated by spaces. If IFS is null, the parameters are joined without intervening separators.
@
Expands to the positional parameters, starting from one. When the expansion occurs within double quotes, each parameter expands to a separate word. That is, "$@" is equivalent to "$1" "$2" ... If the double-quoted expansion occurs within a word, the expansion of the first parameter is joined with the beginning part of the original word, and the expansion of the last parameter is joined with the last part of the original word. When there are no positional parameters, "$@" and $@ expand to nothing (i.e., they are removed).
#
Expands to the number of positional parameters in decimal.
?
Expands to the status of the most recently executed foreground pipeline.
-
Expands to the current option flags as specified upon invocation, by the set builtin command, or those set by the shell itself (such as the -i option).
$
Expands to the process ID of the shell. In a () subshell, it expands to the process ID of the current shell, not the subshell.
!
Expands to the process ID of the most recently executed background (asynchronous) command.
0
Expands to the name of the shell or shell script. This is set at shell initialization. If bash is invoked with a file of commands, $0 is set to the name of that file. If bash is started with the -c option, then $0 is set to the first argument after the string to be executed, if one is present. Otherwise, it is set to the file name used to invoke bash, as given by argument zero.
_
At shell startup, set to the absolute pathname used to invoke the shell or shell script being executed as passed in the environment or argument list. Subsequently, expands to the last argument to the previous command, after expansion. Also set to the full pathname used to invoke each command executed and placed in the environment exported to that command. When checking mail, this parameter holds the name of the mail file currently being checked.
 

Shell Variables

The following variables are set by the shell:

BASH
Expands to the full file name used to invoke this instance of bash.
BASH_ARGC
An array variable whose values are the number of parameters in each frame of the current bash execution call stack. The number of parameters to the current subroutine (shell function or script executed with . or source) is at the top of the stack. When a subroutine is executed, the number of parameters passed is pushed onto BASH_ARGC. The shell sets BASH_ARGC only when in extended debugging mode (see the description of the extdebug option to the shopt builtin below)
BASH_ARGV
An array variable containing all of the parameters in the current bash execution call stack. The final parameter of the last subroutine call is at the top of the stack; the first parameter of the initial call is at the bottom. When a subroutine is executed, the parameters supplied are pushed onto BASH_ARGV. The shell sets BASH_ARGV only when in extended debugging mode (see the description of the extdebug option to the shopt builtin below)
BASH_COMMAND
The command currently being executed or about to be executed, unless the shell is executing a command as the result of a trap, in which case it is the command executing at the time of the trap.
BASH_EXECUTION_STRING
The command argument to the -c invocation option.
BASH_LINENO
An array variable whose members are the line numbers in source files corresponding to each member of FUNCNAME. ${BASH_LINENO[$i]} is the line number in the source file where ${FUNCNAME[$ifP]} was called. The corresponding source file name is ${BASH_SOURCE[$i]}. Use LINENO to obtain the current line number.
BASH_REMATCH
An array variable whose members are assigned by the =~ binary operator to the [[ conditional command. The element with index 0 is the portion of the string matching the entire regular expression. The element with index n is the portion of the string matching the nth parenthesized subexpression. This variable is read-only.
BASH_SOURCE
An array variable whose members are the source filenames corresponding to the elements in the FUNCNAME array variable.
BASH_SUBSHELL
Incremented by one each time a subshell or subshell environment is spawned. The initial value is 0.
BASH_VERSINFO
A readonly array variable whose members hold version information for this instance of bash. The values assigned to the array members are as follows:

BASH_VERSINFO[0]
The major version number (the release).
BASH_VERSINFO[1]
The minor version number (the version).
BASH_VERSINFO[2]
The patch level.
BASH_VERSINFO[3]
The build version.
BASH_VERSINFO[4]
The release status (e.g., beta1).
BASH_VERSINFO[5]
The value of MACHTYPE.
BASH_VERSION
Expands to a string describing the version of this instance of bash.
COMP_CWORD
An index into ${COMP_WORDS} of the word containing the current cursor position. This variable is available only in shell functions invoked by the programmable completion facilities (see Programmable Completion below).
COMP_LINE
The current command line. This variable is available only in shell functions and external commands invoked by the programmable completion facilities (see Programmable Completion below).
COMP_POINT
The index of the current cursor position relative to the beginning of the current command. If the current cursor position is at the end of the current command, the value of this variable is equal to ${#COMP_LINE}. This variable is available only in shell functions and external commands invoked by the programmable completion facilities (see Programmable Completion below).
COMP_WORDBREAKS
The set of characters that the Readline library treats as word separators when performing word completion. If COMP_WORDBREAKS is unset, it loses its special properties, even if it is subsequently reset.
COMP_WORDS
An array variable (see Arrays below) consisting of the individual words in the current command line. This variable is available only in shell functions invoked by the programmable completion facilities (see Programmable Completion below).
DIRSTACK
An array variable (see Arrays below) containing the current contents of the directory stack. Directories appear in the stack in the order they are displayed by the dirs builtin. Assigning to members of this array variable may be used to modify directories already in the stack, but the pushd and popd builtins must be used to add and remove directories. Assignment to this variable will not change the current directory. If DIRSTACK is unset, it loses its special properties, even if it is subsequently reset.
EUID
Expands to the effective user ID of the current user, initialized at shell startup. This variable is readonly.
FUNCNAME
An array variable containing the names of all shell functions currently in the execution call stack. The element with index 0 is the name of any currently-executing shell function. The bottom-most element is "main". This variable exists only when a shell function is executing. Assignments to FUNCNAME have no effect and return an error status. If FUNCNAME is unset, it loses its special properties, even if it is subsequently reset.
GROUPS
An array variable containing the list of groups of which the current user is a member. Assignments to GROUPS have no effect and return an error status. If GROUPS is unset, it loses its special properties, even if it is subsequently reset.
HISTCMD
The history number, or index in the history list, of the current command. If HISTCMD is unset, it loses its special properties, even if it is subsequently reset.
HOSTNAME
Automatically set to the name of the current host.
HOSTTYPE
Automatically set to a string that uniquely describes the type of machine on which bash is executing. The default is system-dependent.
LINENO
Each time this parameter is referenced, the shell substitutes a decimal number representing the current sequential line number (starting with 1) within a script or function. When not in a script or function, the value substituted is not guaranteed to be meaningful. If LINENO is unset, it loses its special properties, even if it is subsequently reset.
MACHTYPE
Automatically set to a string that fully describes the system type on which bash is executing, in the standard GNU cpu-company-system format. The default is system-dependent.
OLDPWD
The previous working directory as set by the cd command.
OPTARG
The value of the last option argument processed by the getopts builtin command (see SHELL BUILTIN COMMANDS below).
OPTIND
The index of the next argument to be processed by the getopts builtin command (see SHELL BUILTIN COMMANDS below).
OSTYPE
Automatically set to a string that describes the operating system on which bash is executing. The default is system-dependent.
PIPESTATUS
An array variable (see Arrays below) containing a list of exit status values from the processes in the most-recently-executed foreground pipeline (which may contain only a single command).
PPID
The process ID of the shell's parent. This variable is readonly.
PWD
The current working directory as set by the cd command.
RANDOM
Each time this parameter is referenced, a random integer between 0 and 32767 is generated. The sequence of random numbers may be initialized by assigning a value to RANDOM. If RANDOM is unset, it loses its special properties, even if it is subsequently reset.
REPLY
Set to the line of input read by the read builtin command when no arguments are supplied.
SECONDS
Each time this parameter is referenced, the number of seconds since shell invocation is returned. If a value is assigned to SECONDS, the value returned upon subsequent references is the number of seconds since the assignment plus the value assigned. If SECONDS is unset, it loses its special properties, even if it is subsequently reset.
SHELLOPTS
A colon-separated list of enabled shell options. Each word in the list is a valid argument for the -o option to the set builtin command (see SHELL BUILTIN COMMANDS below). The options appearing in SHELLOPTS are those reported as on by set -o. If this variable is in the environment when bash starts up, each shell option in the list will be enabled before reading any startup files. This variable is read-only.
SHLVL
Incremented by one each time an instance of bash is started.
UID
Expands to the user ID of the current user, initialized at shell startup. This variable is readonly.

The following variables are used by the shell. In some cases, bash assigns a default value to a variable; these cases are noted below.

BASH_ENV
If this parameter is set when bash is executing a shell script, its value is interpreted as a filename containing commands to initialize the shell, as in ~/.bashrc. The value of BASH_ENV is subjected to parameter expansion, command substitution, and arithmetic expansion before being interpreted as a file name. PATH is not used to search for the resultant file name.
CDPATH
The search path for the cd command. This is a colon-separated list of directories in which the shell looks for destination directories specified by the cd command. A sample value is ".:~:/usr".
COLUMNS
Used by the select builtin command to determine the terminal width when printing selection lists. Automatically set upon receipt of a SIGWINCH.
COMPREPLY
An array variable from which bash reads the possible completions generated by a shell function invoked by the programmable completion facility (see Programmable Completion below).
EMACS
If bash finds this variable in the environment when the shell starts with value "t", it assumes that the shell is running in an emacs shell buffer and disables line editing.
FCEDIT
The default editor for the fc builtin command.
FIGNORE
A colon-separated list of suffixes to ignore when performing filename completion (see READLINE below). A filename whose suffix matches one of the entries in FIGNORE is excluded from the list of matched filenames. A sample value is ".o:~".
GLOBIGNORE
A colon-separated list of patterns defining the set of filenames to be ignored by pathname expansion. If a filename matched by a pathname expansion pattern also matches one of the patterns in GLOBIGNORE, it is removed from the list of matches.
HISTCONTROL
A colon-separated list of values controlling how commands are saved on the history list. If the list of values includes ignorespace, lines which begin with a space character are not saved in the history list. A value of ignoredups causes lines matching the previous history entry to not be saved. A value of ignoreboth is shorthand for ignorespace and ignoredups. A value of erasedups causes all previous lines matching the current line to be removed from the history list before that line is saved. Any value not in the above list is ignored. If HISTCONTROL is unset, or does not include a valid value, all lines read by the shell parser are saved on the history list, subject to the value of HISTIGNORE. The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of HISTCONTROL.
HISTFILE
The name of the file in which command history is saved (see HISTORY below). The default value is ~/.bash_history. If unset, the command history is not saved when an interactive shell exits.
HISTFILESIZE
The maximum number of lines contained in the history file. When this variable is assigned a value, the history file is truncated, if necessary, to contain no more than that number of lines. The default value is 500. The history file is also truncated to this size after writing it when an interactive shell exits.
HISTIGNORE
A colon-separated list of patterns used to decide which command lines should be saved on the history list. Each pattern is anchored at the beginning of the line and must match the complete line (no implicit `*' is appended). Each pattern is tested against the line after the checks specified by HISTCONTROL are applied. In addition to the normal shell pattern matching characters, `&' matches the previous history line. `&' may be escaped using a backslash; the backslash is removed before attempting a match. The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regardless of the value of HISTIGNORE.
HISTSIZE
The number of commands to remember in the command history (see HISTORY below). The default value is 500.
HISTTIMEFORMAT
If this variable is set and not null, its value is used as a format string for strftime(3) to print the time stamp associated with each history entry displayed by the history builtin. If this variable is set, time stamps are written to the history file so they may be preserved across shell sessions.
HOME
The home directory of the current user; the default argument for the cd builtin command. The value of this variable is also used when performing tilde expansion.
HOSTFILE
Contains the name of a file in the same format as /etc/hosts that should be read when the shell needs to complete a hostname. The list of possible hostname completions may be changed while the shell is running; the next time hostname completion is attempted after the value is changed, bash adds the contents of the new file to the existing list. If HOSTFILE is set, but has no value, bash attempts to read /etc/hosts to obtain the list of possible hostname completions. When HOSTFILE is unset, the hostname list is cleared.
IFS
The Internal Field Separator that is used for word splitting after expansion and to split lines into words with the read builtin command. The default value is ``<space><tab><newline>''.
IGNOREEOF
Controls the action of an interactive shell on receipt of an EOF character as the sole input. If set, the value is the number of consecutive EOF characters which must be typed as the first characters on an input line before bash exits. If the variable exists but does not have a numeric value, or has no value, the default value is 10. If it does not exist, EOF signifies the end of input to the shell.
INPUTRC
The filename for the readline startup file, overriding the default of ~/.inputrc (see READLINE below).
LANG
Used to determine the locale category for any category not specifically selected with a variable starting with LC_.
LC_ALL
This variable overrides the value of LANG and any other LC_ variable specifying a locale category.
LC_COLLATE
This variable determines the collation order used when sorting the results of pathname expansion, and determines the behavior of range expressions, equivalence classes, and collating sequences within pathname expansion and pattern matching.
LC_CTYPE
This variable determines the interpretation of characters and the behavior of character classes within pathname expansion and pattern matching.
LC_MESSAGES
This variable determines the locale used to translate double-quoted strings preceded by a $.
LC_NUMERIC
This variable determines the locale category used for number formatting.
LINES
Used by the select builtin command to determine the column length for printing selection lists. Automatically set upon receipt of a SIGWINCH.
MAIL
If this parameter is set to a file name and the MAILPATH variable is not set, bash informs the user of the arrival of mail in the specified file.
MAILCHECK
Specifies how often (in seconds) bash checks for mail. The default is 60 seconds. When it is time to check for mail, the shell does so before displaying the primary prompt. If this variable is unset, or set to a value that is not a number greater than or equal to zero, the shell disables mail checking.
MAILPATH
A colon-separated list of file names to be checked for mail. The message to be printed when mail arrives in a particular file may be specified by separating the file name from the message with a `?'. When used in the text of the message, $_ expands to the name of the current mailfile. Example:

MAILPATH=aq/var/mail/bfox?"You have mail":~/shell-mail?"$_ has mail!"aq

Bash supplies a default value for this variable, but the location of the user mail files that it uses is system dependent (e.g., /var/mail/$USER).

OPTERR
If set to the value 1, bash displays error messages generated by the getopts builtin command (see SHELL BUILTIN COMMANDS below). OPTERR is initialized to 1 each time the shell is invoked or a shell script is executed.
PATH
The search path for commands. It is a colon-separated list of directories in which the shell looks for commands (see COMMAND EXECUTION below). A zero-length (null) directory name in the value of PATH indicates the current directory. A null directory name may appear as two adjacent colons, or as an initial or trailing colon. The default path is system-dependent, and is set by the administrator who installs bash. A common value is ``/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin''.
POSIXLY_CORRECT
If this variable is in the environment when bash starts, the shell enters posix mode before reading the startup files, as if the --posix invocation option had been supplied. If it is set while the shell is running, bash enables posix mode, as if the command set -o posix had been executed.
PROMPT_COMMAND
If set, the value is executed as a command prior to issuing each primary prompt.
PS1
The value of this parameter is expanded (see PROMPTING below) and used as the primary prompt string. The default value is ``\s-\v\$ ''.
PS2
The value of this parameter is expanded as with PS1 and used as the secondary prompt string. The default is ``> ''.
PS3
The value of this parameter is used as the prompt for the select command (see SHELL GRAMMAR above).
PS4
The value of this parameter is expanded as with PS1 and the value is printed before each command bash displays during an execution trace. The first character of PS4 is replicated multiple times, as necessary, to indicate multiple levels of indirection. The default is ``+ ''.
SHELL
The full pathname to the shell is kept in this environment variable. If it is not set when the shell starts, bash assigns to it the full pathname of the current user's login shell.
TIMEFORMAT
The value of this parameter is used as a format string specifying how the timing information for pipelines prefixed with the time reserved word should be displayed. The % character introduces an escape sequence that is expanded to a time value or other information. The escape sequences and their meanings are as follows; the braces denote optional portions.

%%
A literal %.
%[p][l]R
The elapsed time in seconds.
%[p][l]U
The number of CPU seconds spent in user mode.
%[p][l]S
The number of CPU seconds spent in system mode.
%P
The CPU percentage, computed as (%U + %S) / %R.
The optional p is a digit specifying the precision, the number of fractional digits after a decimal point. A value of 0 causes no decimal point or fraction to be output. At most three places after the decimal point may be specified; values of p greater than 3 are changed to 3. If p is not specified, the value 3 is used.
The optional l specifies a longer format, including minutes, of the form MMmSS.FFs. The value of p determines whether or not the fraction is included.
If this variable is not set, bash acts as if it had the value $aq\nreal\t%3lR\nuser\t%3lU\nsys %3lSaq. If the value is null, no timing information is displayed. A trailing newline is added when the format string is displayed.
TMOUT
If set to a value greater than zero, TMOUT is treated as the default timeout for the read builtin. The select command terminates if input does not arrive after TMOUT seconds when input is coming from a terminal. In an interactive shell, the value is interpreted as the number of seconds to wait for input after issuing the primary prompt. Bash terminates after waiting for that number of seconds if input does not arrive.
TMPDIR
If set, Bash uses its value as the name of a directory in which Bash creates temporary files for the shell's use.
auto_resume
This variable controls how the shell interacts with the user and job control. If this variable is set, single word simple commands without redirections are treated as candidates for resumption of an existing stopped job. There is no ambiguity allowed; if there is more than one job beginning with the string typed, the job most recently accessed is selected. The name of a stopped job, in this context, is the command line used to start it. If set to the value exact, the string supplied must match the name of a stopped job exactly; if set to substring, the string supplied needs to match a substring of the name of a stopped job. The substring value provides functionality analogous to the %? job identifier (see JOB CONTROL below). If set to any other value, the supplied string must be a prefix of a stopped job's name; this provides functionality analogous to the %string job identifier.
histchars
The two or three characters which control history expansion and tokenization (see HISTORY EXPANSION below). The first character is the history expansion character, the character which signals the start of a history expansion, normally `!'. The second character is the quick substitution character, which is used as shorthand for re-running the previous command entered, substituting one string for another in the command. The default is `^'. The optional third character is the character which indicates that the remainder of the line is a comment when found as the first character of a word, normally `#'. The history comment character causes history substitution to be skipped for the remaining words on the line. It does not necessarily cause the shell parser to treat the rest of the line as a comment.
 

Arrays

Bash provides one-dimensional array variables. Any variable may be used as an array; the declare builtin will explicitly declare an array. There is no maximum limit on the size of an array, nor any requirement that members be indexed or assigned contiguously. Arrays are indexed using integers and are zero-based.

An array is created automatically if any variable is assigned to using the syntax name[subscript]=value. The subscript is treated as an arithmetic expression that must evaluate to a number greater than or equal to zero. To explicitly declare an array, use declare -a name (see SHELL BUILTIN COMMANDS below). declare -a name[subscript] is also accepted; the subscript is ignored. Attributes may be specified for an array variable using the declare and readonly builtins. Each attribute applies to all members of an array.

Arrays are assigned to using compound assignments of the form name=(value1 ... valuen), where each value is of the form [subscript]=string. Only string is required. If the optional brackets and subscript are supplied, that index is assigned to; otherwise the index of the element assigned is the last index assigned to by the statement plus one. Indexing starts at zero. This syntax is also accepted by the declare builtin. Individual array elements may be assigned to using the name[subscript]=value syntax introduced above.

Any element of an array may be referenced using ${name[subscript]}. The braces are required to avoid conflicts with pathname expansion. If subscript is @ or *, the word expands to all members of name. These subscripts differ only when the word appears within double quotes. If the word is double-quoted, ${name[*]} expands to a single word with the value of each array member separated by the first character of the IFS special variable, and ${name[@]} expands each element of name to a separate word. When there are no array members, ${name[@]} expands to nothing. If the double-quoted expansion occurs within a word, the expansion of the first parameter is joined with the beginning part of the original word, and the expansion of the last parameter is joined with the last part of the original word. This is analogous to the expansion of the special parameters * and @ (see Special Parameters above). ${#name[subscript]} expands to the length of ${name[subscript]}. If subscript is * or @, the expansion is the number of elements in the array. Referencing an array variable without a subscript is equivalent to referencing element zero.

The unset builtin is used to destroy arrays. unset name[subscript] destroys the array element at index subscript. Care must be taken to avoid unwanted side effects caused by filename generation. unset name, where name is an array, or unset name[subscript], where subscript is * or @, removes the entire array.

The declare, local, and readonly builtins each accept a -a option to specify an array. The read builtin accepts a -a option to assign a list of words read from the standard input to an array. The set and declare builtins display array values in a way that allows them to be reused as assignments.  

EXPANSION

Expansion is performed on the command line after it has been split into words. There are seven kinds of expansion performed: brace expansion, tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, word splitting, and pathname expansion.

The order of expansions is: brace expansion, tilde expansion, parameter, variable and arithmetic expansion and command substitution (done in a left-to-right fashion), word splitting, and pathname expansion.

On systems that can support it, there is an additional expansion available: process substitution.

Only brace expansion, word splitting, and pathname expansion can change the number of words of the expansion; other expansions expand a single word to a single word. The only exceptions to this are the expansions of "$@" and "${name[@]}" as explained above (see PARAMETERS).  

Brace Expansion

Brace expansion is a mechanism by which arbitrary strings may be generated. This mechanism is similar to pathname expansion, but the filenames generated need not exist. Patterns to be brace expanded take the form of an optional preamble, followed by either a series of comma-separated strings or a sequence expression between a pair of braces, followed by an optional postscript. The preamble is prefixed to each string contained within the braces, and the postscript is then appended to each resulting string, expanding left to right.

Brace expansions may be nested. The results of each expanded string are not sorted; left to right order is preserved. For example, a{d,c,b}e expands into `ade ace abe'.

A sequence expression takes the form {x..y}, where x and y are either integers or single characters. When integers are supplied, the expression expands to each number between x and y, inclusive. When characters are supplied, the expression expands to each character lexicographically between x and y, inclusive. Note that both x and y must be of the same type.

Brace expansion is performed before any other expansions, and any characters special to other expansions are preserved in the result. It is strictly textual. Bash does not apply any syntactic interpretation to the context of the expansion or the text between the braces.

A correctly-formed brace expansion must contain unquoted opening and closing braces, and at least one unquoted comma or a valid sequence expression. Any incorrectly formed brace expansion is left unchanged. A { or , may be quoted with a backslash to prevent its being considered part of a brace expression. To avoid conflicts with parameter expansion, the string ${ is not considered eligible for brace expansion.

This construct is typically used as shorthand when the common prefix of the strings to be generated is longer than in the above example:

mkdir /usr/local/src/bash/{old,new,dist,bugs}

or
chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}

Brace expansion introduces a slight incompatibility with historical versions of sh. sh does not treat opening or closing braces specially when they appear as part of a word, and preserves them in the output. Bash removes braces from words as a consequence of brace expansion. For example, a word entered to sh as file{1,2} appears identically in the output. The same word is output as file1 file2 after expansion by bash. If strict compatibility with sh is desired, start bash with the +B option or disable brace expansion with the +B option to the set command (see SHELL BUILTIN COMMANDS below).  

Tilde Expansion

If a word begins with an unquoted tilde character (`~'), all of the characters preceding the first unquoted slash (or all characters, if there is no unquoted slash) are considered a tilde-prefix. If none of the characters in the tilde-prefix are quoted, the characters in the tilde-prefix following the tilde are treated as a possible login name. If this login name is the null string, the tilde is replaced with the value of the shell parameter HOME. If HOME is unset, the home directory of the user executing the shell is substituted instead. Otherwise, the tilde-prefix is replaced with the home directory associated with the specified login name.

If the tilde-prefix is a `~+', the value of the shell variable PWD replaces the tilde-prefix. If the tilde-prefix is a `~-', the value of the shell variable OLDPWD, if it is set, is substituted. If the characters following the tilde in the tilde-prefix consist of a number N, optionally prefixed by a `+' or a `-', the tilde-prefix is replaced with the corresponding element from the directory stack, as it would be displayed by the dirs builtin invoked with the tilde-prefix as an argument. If the characters following the tilde in the tilde-prefix consist of a number without a leading `+' or `-', `+' is assumed.

If the login name is invalid, or the tilde expansion fails, the word is unchanged.

Each variable assignment is checked for unquoted tilde-prefixes immediately following a : or the first =. In these cases, tilde expansion is also performed. Consequently, one may use file names with tildes in assignments to PATH, MAILPATH, and CDPATH, and the shell assigns the expanded value.  

Parameter Expansion

The `$' character introduces parameter expansion, command substitution, or arithmetic expansion. The parameter name or symbol to be expanded may be enclosed in braces, which are optional but serve to protect the variable to be expanded from characters immediately following it which could be interpreted as part of the name.

When braces are used, the matching ending brace is the first `}' not escaped by a backslash or within a quoted string, and not within an embedded arithmetic expansion, command substitution, or parameter expansion.

${parameter}
The value of parameter is substituted. The braces are required when parameter is a positional parameter with more than one digit, or when parameter is followed by a character which is not to be interpreted as part of its name.

If the first character of parameter is an exclamation point, a level of variable indirection is introduced. Bash uses the value of the variable formed from the rest of parameter as the name of the variable; this variable is then expanded and that value is used in the rest of the substitution, rather than the value of parameter itself. This is known as indirect expansion. The exceptions to this are the expansions of ${!prefix*} and ${!name[@]} described below. The exclamation point must immediately follow the left brace in order to introduce indirection.

In each of the cases below, word is subject to tilde expansion, parameter expansion, command substitution, and arithmetic expansion. When not performing substring expansion, bash tests for a parameter that is unset or null; omitting the colon results in a test only for a parameter that is unset.

${parameter:-word}
Use Default Values. If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted.
${parameter:=word}
Assign Default Values. If parameter is unset or null, the expansion of word is assigned to parameter. The value of parameter is then substituted. Positional parameters and special parameters may not be assigned to in this way.
${parameter:?word}
Display Error if Null or Unset. If parameter is null or unset, the expansion of word (or a message to that effect if word is not present) is written to the standard error and the shell, if it is not interactive, exits. Otherwise, the value of parameter is substituted.
${parameter:+word}
Use Alternate Value. If parameter is null or unset, nothing is substituted, otherwise the expansion of word is substituted.
${parameter:offset}
${parameter:offset:length}
Substring Expansion. Expands to up to length characters of parameter starting at the character specified by offset. If length is omitted, expands to the substring of parameter starting at the character specified by offset. length and offset are arithmetic expressions (see ARITHMETIC EVALUATION below). length must evaluate to a number greater than or equal to zero. If offset evaluates to a number less than zero, the value is used as an offset from the end of the value of parameter. If parameter is @, the result is length positional parameters beginning at offset. If parameter is an array name indexed by @ or *, the result is the length members of the array beginning with ${parameter[offset]}. A negative offset is taken relative to one greater than the maximum index of the specified array. Note that a negative offset must be separated from the colon by at least one space to avoid being confused with the :- expansion. Substring indexing is zero-based unless the positional parameters are used, in which case the indexing starts at 1.
${!prefix*}
${!prefix@}
Expands to the names of variables whose names begin with prefix, separated by the first character of the IFS special variable.
${!name[@]}
${!name[*]}
If name is an array variable, expands to the list of array indices (keys) assigned in name. If name is not an array, expands to 0 if name is set and null otherwise. When @ is used and the expansion appears within double quotes, each key expands to a separate word.
${#parameter}
The length in characters of the value of parameter is substituted. If parameter is * or @, the value substituted is the number of positional parameters. If parameter is an array name subscripted by * or @, the value substituted is the number of elements in the array.
${parameter#word}
${parameter##word}
The word is expanded to produce a pattern just as in pathname expansion. If the pattern matches the beginning of the value of parameter, then the result of the expansion is the expanded value of parameter with the shortest matching pattern (the ``#'' case) or the longest matching pattern (the ``##'' case) deleted. If parameter is @ or *, the pattern removal operation is applied to each positional parameter in turn, and the expansion is the resultant list. If parameter is an array variable subscripted with @ or *, the pattern removal operation is applied to each member of the array in turn, and the expansion is the resultant list.
${parameter%word}
${parameter%%word}
The word is expanded to produce a pattern just as in pathname expansion. If the pattern matches a trailing portion of the expanded value of parameter, then the result of the expansion is the expanded value of parameter with the shortest matching pattern (the ``%'' case) or the longest matching pattern (the ``%%'' case) deleted. If parameter is @ or *, the pattern removal operation is applied to each positional parameter in turn, and the expansion is the resultant list. If parameter is an array variable subscripted with @ or *, the pattern removal operation is applied to each member of the array in turn, and the expansion is the resultant list.
${parameter/pattern/string}
${parameter//pattern/string}
The pattern is expanded to produce a pattern just as in pathname expansion. Parameter is expanded and the longest match of pattern against its value is replaced with string. In the first form, only the first match is replaced. The second form causes all matches of pattern to be replaced with string. If pattern begins with #, it must match at the beginning of the expanded value of parameter. If pattern begins with %, it must match at the end of the expanded value of parameter. If string is null, matches of pattern are deleted and the / following pattern may be omitted. If parameter is @ or *, the substitution operation is applied to each positional parameter in turn, and the expansion is the resultant list. If parameter is an array variable subscripted with @ or *, the substitution operation is applied to each member of the array in turn, and the expansion is the resultant list.
 

Command Substitution

Command substitution allows the output of a command to replace the command name. There are two forms:

$(command)

or
`command`

Bash performs the expansion by executing command and replacing the command substitution with the standard output of the command, with any trailing newlines deleted. Embedded newlines are not deleted, but they may be removed during word splitting. The command substitution $(cat file) can be replaced by the equivalent but faster $(< file).

When the old-style backquote form of substitution is used, backslash retains its literal meaning except when followed by $, `, or \. The first backquote not preceded by a backslash terminates the command substitution. When using the $(command) form, all characters between the parentheses make up the command; none are treated specially.

Command substitutions may be nested. To nest when using the backquoted form, escape the inner backquotes with backslashes.

If the substitution appears within double quotes, word splitting and pathname expansion are not performed on the results.  

Arithmetic Expansion

Arithmetic expansion allows the evaluation of an arithmetic expression and the substitution of the result. The format for arithmetic expansion is:

$((expression))

The expression is treated as if it were within double quotes, but a double quote inside the parentheses is not treated specially. All tokens in the expression undergo parameter expansion, string expansion, command substitution, and quote removal. Arithmetic expansions may be nested.

The evaluation is performed according to the rules listed below under ARITHMETICEVALUATION. If expression is invalid, bash prints a message indicating failure and no substitution occurs.  

Process Substitution

Process substitution is supported on systems that support named pipes (FIFOs) or the /dev/fd method of naming open files. It takes the form of <(list) or >(list). The process list is run with its input or output connected to a FIFO or some file in /dev/fd. The name of this file is passed as an argument to the current command as the result of the expansion. If the >(list) form is used, writing to the file will provide input for list. If the <(list) form is used, the file passed as an argument should be read to obtain the output of list.

When available, process substitution is performed simultaneously with parameter and variable expansion, command substitution, and arithmetic expansion.  

Word Splitting

The shell scans the results of parameter expansion, command substitution, and arithmetic expansion that did not occur within double quotes for word splitting.

The shell treats each character of IFS as a delimiter, and splits the results of the other expansions into words on these characters. If IFS is unset, or its value is exactly <space><tab><newline>, the default, then any sequence of IFS characters serves to delimit words. If IFS has a value other than the default, then sequences of the whitespace characters space and tab are ignored at the beginning and end of the word, as long as the whitespace character is in the value of IFS (an IFS whitespace character). Any character in IFS that is not IFS whitespace, along with any adjacent IFS whitespace characters, delimits a field. A sequence of IFS whitespace characters is also treated as a delimiter. If the value of IFS is null, no word splitting occurs.

Explicit null arguments ("" or aqaq) are retained. Unquoted implicit null arguments, resulting from the expansion of parameters that have no values, are removed. If a parameter with no value is expanded within double quotes, a null argument results and is retained.

Note that if no expansion occurs, no splitting is performed.  

Pathname Expansion

After word splitting, unless the -f option has been set, bash scans each word for the characters *, ?, and [. If one of these characters appears, then the word is regarded as a pattern, and replaced with an alphabetically sorted list of file names matching the pattern. If no matching file names are found, and the shell option nullglob is disabled, the word is left unchanged. If the nullglob option is set, and no matches are found, the word is removed. If the failglob shell option is set, and no matches are found, an error message is printed and the command is not executed. If the shell option nocaseglob is enabled, the match is performed without regard to the case of alphabetic characters. When a pattern is used for pathname expansion, the character ``.'' at the start of a name or immediately following a slash must be matched explicitly, unless the shell option dotglob is set. When matching a pathname, the slash character must always be matched explicitly. In other cases, the ``.'' character is not treated specially. See the description of shopt below under SHELL BUILTIN COMMANDS for a description of the nocaseglob, nullglob, failglob, and dotglob shell options.

The GLOBIGNORE shell variable may be used to restrict the set of file names matching a pattern. If GLOBIGNORE is set, each matching file name that also matches one of the patterns in GLOBIGNORE is removed from the list of matches. The file names ``.'' and ``..'' are always ignored when GLOBIGNORE is set and not null. However, setting GLOBIGNORE to a non-null value has the effect of enabling the dotglob shell option, so all other file names beginning with a ``.'' will match. To get the old behavior of ignoring file names beginning with a ``.'', make ``.*'' one of the patterns in GLOBIGNORE. The dotglob option is disabled when GLOBIGNORE is unset.

Pattern Matching

Any character that appears in a pattern, other than the special pattern characters described below, matches itself. The NUL character may not occur in a pattern. A backslash escapes the following character; the escaping backslash is discarded when matching. The special pattern characters must be quoted if they are to be matched literally.

The special pattern characters have the following meanings:

*
Matches any string, including the null string.
?
Matches any single character.
[...]
Matches any one of the enclosed characters. A pair of characters separated by a hyphen denotes a range expression; any character that sorts between those two characters, inclusive, using the current locale's collating sequence and character set, is matched. If the first character following the [ is a ! or a ^ then any character not enclosed is matched. The sorting order of characters in range expressions is determined by the current locale and the value of the LC_COLLATE shell variable, if set. A - may be matched by including it as the first or last character in the set. A ] may be matched by including it as the first character in the set.

Within [ and ], character classes can be specified using the syntax [:class:], where class is one of the following classes defined in the POSIX.2 standard:

alnum alpha ascii blank cntrl digit graph lower print punct space upper word xdigit
A character class matches any character belonging to that class. The word character class matches letters, digits, and the character _.

Within [ and ], an equivalence class can be specified using the syntax [=c=], which matches all characters with the same collation weight (as defined by the current locale) as the character c.

Within [ and ], the syntax [.symbol.] matches the collating symbol symbol.

If the extglob shell option is enabled using the shopt builtin, several extended pattern matching operators are recognized. In the following description, a pattern-list is a list of one or more patterns separated by a |. Composite patterns may be formed using one or more of the following sub-patterns:

?(pattern-list)
Matches zero or one occurrence of the given patterns
*(pattern-list)
Matches zero or more occurrences of the given patterns
+(pattern-list)
Matches one or more occurrences of the given patterns
@(pattern-list)
Matches one of the given patterns
!(pattern-list)
Matches anything except one of the given patterns
 

Quote Removal

After the preceding expansions, all unquoted occurrences of the characters \, aq, and " that did not result from one of the above expansions are removed.  

REDIRECTION

Before a command is executed, its input and output may be redirected using a special notation interpreted by the shell. Redirection may also be used to open and close files for the current shell execution environment. The following redirection operators may precede or appear anywhere within a simple command or may follow a command. Redirections are processed in the order they appear, from left to right.

In the following descriptions, if the file descriptor number is omitted, and the first character of the redirection operator is <, the redirection refers to the standard input (file descriptor 0). If the first character of the redirection operator is >, the redirection refers to the standard output (file descriptor 1).

The word following the redirection operator in the following descriptions, unless otherwise noted, is subjected to brace expansion, tilde expansion, parameter expansion, command substitution, arithmetic expansion, quote removal, pathname expansion, and word splitting. If it expands to more than one word, bash reports an error.

Note that the order of redirections is significant. For example, the command

ls > dirlist 2>&1

directs both standard output and standard error to the file dirlist, while the command

ls 2>&1 > dirlist

directs only the standard output to file dirlist, because the standard error was duplicated as standard output before the standard output was redirected to dirlist.

Bash handles several filenames specially when they are used in redirections, as described in the following table:

/dev/fd/fd
If fd is a valid integer, file descriptor fd is duplicated.
/dev/stdin
File descriptor 0 is duplicated.
/dev/stdout
File descriptor 1 is duplicated.
/dev/stderr
File descriptor 2 is duplicated.
/dev/tcp/host/port
If host is a valid hostname or Internet address, and port is an integer port number or service name, bash attempts to open a TCP connection to the corresponding socket.
/dev/udp/host/port
If host is a valid hostname or Internet address, and port is an integer port number or service name, bash attempts to open a UDP connection to the corresponding socket.

A failure to open or create a file causes the redirection to fail.

Redirections using file descriptors greater than 9 should be used with care, as they may conflict with file descriptors the shell uses internally.  

Redirecting Input

Redirection of input causes the file whose name results from the expansion of word to be opened for reading on file descriptor n, or the standard input (file descriptor 0) if n is not specified.

The general format for redirecting input is:

[n]<word

 

Redirecting Output

Redirection of output causes the file whose name results from the expansion of word to be opened for writing on file descriptor n, or the standard output (file descriptor 1) if n is not specified. If the file does not exist it is created; if it does exist it is truncated to zero size.

The general format for redirecting output is:

[n]>word

If the redirection operator is >, and the noclobber option to the set builtin has been enabled, the redirection will fail if the file whose name results from the expansion of word exists and is a regular file. If the redirection operator is >|, or the redirection operator is > and the noclobber option to the set builtin command is not enabled, the redirection is attempted even if the file named by word exists.  

Appending Redirected Output

Redirection of output in this fashion causes the file whose name results from the expansion of word to be opened for appending on file descriptor n, or the standard output (file descriptor 1) if n is not specified. If the file does not exist it is created.

The general format for appending output is:

[n]>>word

 

Redirecting Standard Output and Standard Error

Bash allows both the standard output (file descriptor 1) and the standard error output (file descriptor 2) to be redirected to the file whose name is the expansion of word with this construct.

There are two formats for redirecting standard output and standard error:

&>word

and
>&word

Of the two forms, the first is preferred. This is semantically equivalent to

>word 2>&1

 

Here Documents

This type of redirection instructs the shell to read input from the current source until a line containing only word (with no trailing blanks) is seen. All of the lines read up to that point are then used as the standard input for a command.

The format of here-documents is:

<<[-]word
        here-document
delimiter

No parameter expansion, command substitution, arithmetic expansion, or pathname expansion is performed on word. If any characters in word are quoted, the delimiter is the result of quote removal on word, and the lines in the here-document are not expanded. If word is unquoted, all lines of the here-document are subjected to parameter expansion, command substitution, and arithmetic expansion. In the latter case, the character sequence \<newline> is ignored, and \ must be used to quote the characters \, $, and `.

If the redirection operator is <<-, then all leading tab characters are stripped from input lines and the line containing delimiter. This allows here-documents within shell scripts to be indented in a natural fashion.  

Here Strings

A variant of here documents, the format is:

<<<word

The word is expanded and supplied to the command on its standard input.  

Duplicating File Descriptors

The redirection operator

[n]<&word

is used to duplicate input file descriptors. If word expands to one or more digits, the file descriptor denoted by n is made to be a copy of that file descriptor. If the digits in word do not specify a file descriptor open for input, a redirection error occurs. If word evaluates to -, file descriptor n is closed. If n is not specified, the standard input (file descriptor 0) is used.

The operator

[n]>&word

is used similarly to duplicate output file descriptors. If n is not specified, the standard output (file descriptor 1) is used. If the digits in word do not specify a file descriptor open for output, a redirection error occurs. As a special case, if n is omitted, and word does not expand to one or more digits, the standard output and standard error are redirected as described previously.  

Moving File Descriptors

The redirection operator

[n]<&digit-

moves the file descriptor digit to file descriptor n, or the standard input (file descriptor 0) if n is not specified. digit is closed after being duplicated to n.

Similarly, the redirection operator

[n]>&digit-

moves the file descriptor digit to file descriptor n, or the standard output (file descriptor 1) if n is not specified.  

Opening File Descriptors for Reading and Writing

The redirection operator

[n]<>word

causes the file whose name is the expansion of word to be opened for both reading and writing on file descriptor n, or on file descriptor 0 if n is not specified. If the file does not exist, it is created.  

ALIASES

Aliases allow a string to be substituted for a word when it is used as the first word of a simple command. The shell maintains a list of aliases that may be set and unset with the alias and unalias builtin commands (see SHELL BUILTIN COMMANDS below). The first word of each simple command, if unquoted, is checked to see if it has an alias. If so, that word is replaced by the text of the alias. The characters /, $, `, and = and any of the shell metacharacters or quoting characters listed above may not appear in an alias name. The replacement text may contain any valid shell input, including shell metacharacters. The first word of the replacement text is tested for aliases, but a word that is identical to an alias being expanded is not expanded a second time. This means that one may alias ls to ls -F, for instance, and bash does not try to recursively expand the replacement text. If the last character of the alias value is a blank, then the next command word following the alias is also checked for alias expansion.

Aliases are created and listed with the alias command, and removed with the unalias command.

There is no mechanism for using arguments in the replacement text. If arguments are needed, a shell function should be used (see FUNCTIONS below).

Aliases are not expanded when the shell is not interactive, unless the expand_aliases shell option is set using shopt (see the description of shopt under SHELL BUILTIN COMMANDS below).

The rules concerning the definition and use of aliases are somewhat confusing. Bash always reads at least one complete line of input before executing any of the commands on that line. Aliases are expanded when a command is read, not when it is executed. Therefore, an alias definition appearing on the same line as another command does not take effect until the next line of input is read. The commands following the alias definition on that line are not affected by the new alias. This behavior is also an issue when functions are executed. Aliases are expanded when a function definition is read, not when the function is executed, because a function definition is itself a compound command. As a consequence, aliases defined in a function are not available until after that function is executed. To be safe, always put alias definitions on a separate line, and do not use alias in compound commands.

For almost every purpose, aliases are superseded by shell functions.  

FUNCTIONS

A shell function, defined as described above under SHELLGRAMMAR, stores a series of commands for later execution. When the name of a shell function is used as a simple command name, the list of commands associated with that function name is executed. Functions are executed in the context of the current shell; no new process is created to interpret them (contrast this with the execution of a shell script). When a function is executed, the arguments to the function become the positional parameters during its execution. The special parameter # is updated to reflect the change. Special parameter 0 is unchanged. The first element of the FUNCNAME variable is set to the name of the function while the function is executing. All other aspects of the shell execution environment are identical between a function and its caller with the exception that the DEBUG and RETURN traps (see the description of the trap builtin under SHELL BUILTIN COMMANDS below) are not inherited unless the function has been given the trace attribute (see the description of the declare builtin below) or the -o functrace shell option has been enabled with the set builtin (in which case all functions inherit the DEBUG and RETURN traps).

Variables local to the function may be declared with the local builtin command. Ordinarily, variables and their values are shared between the function and its caller.

If the builtin command return is executed in a function, the function completes and execution resumes with the next command after the function call. Any command associated with the RETURN trap is executed before execution resumes. When a function completes, the values of the positional parameters and the special parameter # are restored to the values they had prior to the function's execution.

Function names and definitions may be listed with the -f option to the declare or typeset builtin commands. The -F option to declare or typeset will list the function names only (and optionally the source file and line number, if the extdebug shell option is enabled). Functions may be exported so that subshells automatically have them defined with the -f option to the export builtin. Note that shell functions and variables with the same name may result in multiple identically-named entries in the environment passed to the shell's children. Care should be taken in cases where this may cause a problem.

Functions may be recursive. No limit is imposed on the number of recursive calls.  

ARITHMETIC EVALUATION

The shell allows arithmetic expressions to be evaluated, under certain circumstances (see the let and declare builtin commands and Arithmetic Expansion). Evaluation is done in fixed-width integers with no check for overflow, though division by 0 is trapped and flagged as an error. The operators and their precedence, associativity, and values are the same as in the C language. The following list of operators is grouped into levels of equal-precedence operators. The levels are listed in order of decreasing precedence.

id++ id--
variable post-increment and post-decrement
++id --id
variable pre-increment and pre-decrement
- +
unary minus and plus
! ~
logical and bitwise negation
**
exponentiation
* / %
multiplication, division, remainder
+ -
addition, subtraction
<< >>
left and right bitwise shifts
<= >= < >
comparison
== !=
equality and inequality
&
bitwise AND
^
bitwise exclusive OR
|
bitwise OR
&&
logical AND
||
logical OR
expr?expr:expr
conditional operator
= *= /= %= += -= <<= >>= &= ^= |=
assignment
expr1 , expr2
comma

Shell variables are allowed as operands; parameter expansion is performed before the expression is evaluated. Within an expression, shell variables may also be referenced by name without using the parameter expansion syntax. A shell variable that is null or unset evaluates to 0 when referenced by name without using the parameter expansion syntax. The value of a variable is evaluated as an arithmetic expression when it is referenced, or when a variable which has been given the integer attribute using declare -i is assigned a value. A null value evaluates to 0. A shell variable need not have its integer attribute turned on to be used in an expression.

Constants with a leading 0 are interpreted as octal numbers. A leading 0x or 0X denotes hexadecimal. Otherwise, numbers take the form [base#]n, where base is a decimal number between 2 and 64 representing the arithmetic base, and n is a number in that base. If base# is omitted, then base 10 is used. The digits greater than 9 are represented by the lowercase letters, the uppercase letters, @, and _, in that order. If base is less than or equal to 36, lowercase and uppercase letters may be used interchangeably to represent numbers between 10 and 35.

Operators are evaluated in order of precedence. Sub-expressions in parentheses are evaluated first and may override the precedence rules above.  

CONDITIONAL EXPRESSIONS

Conditional expressions are used by the [[ compound command and the test and [ builtin commands to test file attributes and perform string and arithmetic comparisons. Expressions are formed from the following unary or binary primaries. If any file argument to one of the primaries is of the form /dev/fd/n, then file descriptor n is checked. If the file argument to one of the primaries is one of /dev/stdin, /dev/stdout, or /dev/stderr, file descriptor 0, 1, or 2, respectively, is checked.

Unless otherwise specified, primaries that operate on files follow symbolic links and operate on the target of the link, rather than the link itself.

-a file
True if file exists.
-b file
True if file exists and is a block special file.
-c file
True if file exists and is a character special file.
-d file
True if file exists and is a directory.
-e file
True if file exists.
-f file
True if file exists and is a regular file.
-g file
True if file exists and is set-group-id.
-h file
True if file exists and is a symbolic link.
-k file
True if file exists and its ``sticky'' bit is set.
-p file
True if file exists and is a named pipe (FIFO).
-r file
True if file exists and is readable.
-s file
True if file exists and has a size greater than zero.
-t fd
True if file descriptor fd is open and refers to a terminal.
-u file
True if file exists and its set-user-id bit is set.
-w file
True if file exists and is writable.
-x file
True if file exists and is executable.
-O file
True if file exists and is owned by the effective user id.
-G file
True if file exists and is owned by the effective group id.
-L file
True if file exists and is a symbolic link.
-S file
True if file exists and is a socket.
-N file
True if file exists and has been modified since it was last read.
file1 -nt file2
True if file1 is newer (according to modification date) than file2, or if file1 exists and file2 does not.
file1 -ot file2
True if file1 is older than file2, or if file2 exists and file1 does not.
file1 -ef file2
True if file1 and file2 refer to the same device and inode numbers.
-o optname
True if shell option optname is enabled. See the list of options under the description of the -o option to the set builtin below.
-z string
True if the length of string is zero.
string
-n string
True if the length of string is non-zero.
string1 == string2
True if the strings are equal. = may be used in place of == for strict POSIX compliance.
string1 != string2
True if the strings are not equal.
string1 < string2
True if string1 sorts before string2 lexicographically in the current locale.
string1 > string2
True if string1 sorts after string2 lexicographically in the current locale.
arg1 OP arg2
OP is one of -eq, -ne, -lt, -le, -gt, or -ge. These arithmetic binary operators return true if arg1 is equal to, not equal to, less than, less than or equal to, greater than, or greater than or equal to arg2, respectively. Arg1 and arg2 may be positive or negative integers.
 

SIMPLE COMMAND EXPANSION

When a simple command is executed, the shell performs the following expansions, assignments, and redirections, from left to right.
1.
The words that the parser has marked as variable assignments (those preceding the command name) and redirections are saved for later processing.
2.
The words that are not variable assignments or redirections are expanded. If any words remain after expansion, the first word is taken to be the name of the command and the remaining words are the arguments.
3.
Redirections are performed as described above under REDIRECTION.
4.
The text after the = in each variable assignment undergoes tilde expansion, parameter expansion, command substitution, arithmetic expansion, and quote removal before being assigned to the variable.

If no command name results, the variable assignments affect the current shell environment. Otherwise, the variables are added to the environment of the executed command and do not affect the current shell environment. If any of the assignments attempts to assign a value to a readonly variable, an error occurs, and the command exits with a non-zero status.

If no command name results, redirections are performed, but do not affect the current shell environment. A redirection error causes the command to exit with a non-zero status.

If there is a command name left after expansion, execution proceeds as described below. Otherwise, the command exits. If one of the expansions contained a command substitution, the exit status of the command is the exit status of the last command substitution performed. If there were no command substitutions, the command exits with a status of zero.  

COMMAND EXECUTION

After a command has been split into words, if it results in a simple command and an optional list of arguments, the following actions are taken.

If the command name contains no slashes, the shell attempts to locate it. If there exists a shell function by that name, that function is invoked as described above in FUNCTIONS. If the name does not match a function, the shell searches for it in the list of shell builtins. If a match is found, that builtin is invoked.

If the name is neither a shell function nor a builtin, and contains no slashes, bash searches each element of the PATH for a directory containing an executable file by that name. Bash uses a hash table to remember the full pathnames of executable files (see hash under SHELL BUILTIN COMMANDS below). A full search of the directories in PATH is performed only if the command is not found in the hash table. If the search is unsuccessful, the shell prints an error message and returns an exit status of 127.

If the search is successful, or if the command name contains one or more slashes, the shell executes the named program in a separate execution environment. Argument 0 is set to the name given, and the remaining arguments to the command are set to the arguments given, if any.

If this execution fails because the file is not in executable format, and the file is not a directory, it is assumed to be a shell script, a file containing shell commands. A subshell is spawned to execute it. This subshell reinitializes itself, so that the effect is as if a new shell had been invoked to handle the script, with the exception that the locations of commands remembered by the parent (see hash below under SHELL BUILTIN COMMANDS) are retained by the child.

If the program is a file beginning with #!, the remainder of the first line specifies an interpreter for the program. The shell executes the specified interpreter on operating systems that do not handle this executable format themselves. The arguments to the interpreter consist of a single optional argument following the interpreter name on the first line of the program, followed by the name of the program, followed by the command arguments, if any.  

COMMAND EXECUTION ENVIRONMENT

The shell has an execution environment, which consists of the following:

*
open files inherited by the shell at invocation, as modified by redirections supplied to the exec builtin
*
the current working directory as set by cd, pushd, or popd, or inherited by the shell at invocation
*
the file creation mode mask as set by umask or inherited from the shell's parent
*
current traps set by trap
*
shell parameters that are set by variable assignment or with set or inherited from the shell's parent in the environment
*
shell functions defined during execution or inherited from the shell's parent in the environment
*
options enabled at invocation (either by default or with command-line arguments) or by set
*
options enabled by shopt
*
shell aliases defined with alias
*
various process IDs, including those of background jobs, the value of $$, and the value of $PPID

When a simple command other than a builtin or shell function is to be executed, it is invoked in a separate execution environment that consists of the following. Unless otherwise noted, the values are inherited from the shell.

*
the shell's open files, plus any modifications and additions specified by redirections to the command
*
the current working directory
*
the file creation mode mask
*
shell variables and functions marked for export, along with variables exported for the command, passed in the environment
*
traps caught by the shell are reset to the values inherited from the shell's parent, and traps ignored by the shell are ignored

A command invoked in this separate environment cannot affect the shell's execution environment.

Command substitution, commands grouped with parentheses, and asynchronous commands are invoked in a subshell environment that is a duplicate of the shell environment, except that traps caught by the shell are reset to the values that the shell inherited from its parent at invocation. Builtin commands that are invoked as part of a pipeline are also executed in a subshell environment. Changes made to the subshell environment cannot affect the shell's execution environment.

If a command is followed by a & and job control is not active, the default standard input for the command is the empty file /dev/null. Otherwise, the invoked command inherits the file descriptors of the calling shell as modified by redirections.  

ENVIRONMENT

When a program is invoked it is given an array of strings called the environment. This is a list of name-value pairs, of the form name=value.

The shell provides several ways to manipulate the environment. On invocation, the shell scans its own environment and creates a parameter for each name found, automatically marking it for export to child processes. Executed commands inherit the environment. The export and declare -x commands allow parameters and functions to be added to and deleted from the environment. If the value of a parameter in the environment is modified, the new value becomes part of the environment, replacing the old. The environment inherited by any executed command consists of the shell's initial environment, whose values may be modified in the shell, less any pairs removed by the unset command, plus any additions via the export and declare -x commands.

The environment for any simple command or function may be augmented temporarily by prefixing it with parameter assignments, as described above in PARAMETERS. These assignment statements affect only the environment seen by that command.

If the -k option is set (see the set builtin command below), then all parameter assignments are placed in the environment for a command, not just those that precede the command name.

When bash invokes an external command, the variable _ is set to the full file name of the command and passed to that command in its environment.  

EXIT STATUS

For the shell's purposes, a command which exits with a zero exit status has succeeded. An exit status of zero indicates success. A non-zero exit status indicates failure. When a command terminates on a fatal signal N, bash uses the value of 128+N as the exit status.

If a command is not found, the child process created to execute it returns a status of 127. If a command is found but is not executable, the return status is 126.

If a command fails because of an error during expansion or redirection, the exit status is greater than zero.

Shell builtin commands return a status of 0 (true) if successful, and non-zero (false) if an error occurs while they execute. All builtins return an exit status of 2 to indicate incorrect usage.

Bash itself returns the exit status of the last command executed, unless a syntax error occurs, in which case it exits with a non-zero value. See also the exit builtin command below.  

SIGNALS

When bash is interactive, in the absence of any traps, it ignores SIGTERM (so that kill 0 does not kill an interactive shell), and SIGINT is caught and handled (so that the wait builtin is interruptible). In all cases, bash ignores SIGQUIT. If job control is in effect, bash ignores SIGTTIN, SIGTTOU, and SIGTSTP.

Non-builtin commands run by bash have signal handlers set to the values inherited by the shell from its parent. When job control is not in effect, asynchronous commands ignore SIGINT and SIGQUIT in addition to these inherited handlers. Commands run as a result of command substitution ignore the keyboard-generated job control signals SIGTTIN, SIGTTOU, and SIGTSTP.

The shell exits by default upon receipt of a SIGHUP. Before exiting, an interactive shell resends the SIGHUP to all jobs, running or stopped. Stopped jobs are sent SIGCONT to ensure that they receive the SIGHUP. To prevent the shell from sending the signal to a particular job, it should be removed from the jobs table with the disown builtin (see SHELL BUILTIN COMMANDS below) or marked to not receive SIGHUP using disown -h.

If the huponexit shell option has been set with shopt, bash sends a SIGHUP to all jobs when an interactive login shell exits.

If bash is waiting for a command to complete and receives a signal for which a trap has been set, the trap will not be executed until the command completes. When bash is waiting for an asynchronous command via the wait builtin, the reception of a signal for which a trap has been set will cause the wait builtin to return immediately with an exit status greater than 128, immediately after which the trap is executed.  

JOB CONTROL

Job control refers to the ability to selectively stop (suspend) the execution of processes and continue (resume) their execution at a later point. A user typically employs this facility via an interactive interface supplied jointly by the system's terminal driver and bash.

The shell associates a job with each pipeline. It keeps a table of currently executing jobs, which may be listed with the jobs command. When bash starts a job asynchronously (in the background), it prints a line that looks like:

[1] 25647

indicating that this job is job number 1 and that the process ID of the last process in the pipeline associated with this job is 25647. All of the processes in a single pipeline are members of the same job. Bash uses the job abstraction as the basis for job control.

To facilitate the implementation of the user interface to job control, the operating system maintains the notion of a current terminal process group ID. Members of this process group (processes whose process group ID is equal to the current terminal process group ID) receive keyboard-generated signals such as SIGINT. These processes are said to be in the foreground. Background processes are those whose process group ID differs from the terminal's; such processes are immune to keyboard-generated signals. Only foreground processes are allowed to read from or write to the terminal. Background processes which attempt to read from (write to) the terminal are sent a SIGTTIN (SIGTTOU) signal by the terminal driver, which, unless caught, suspends the process.

If the operating system on which bash is running supports job control, bash contains facilities to use it. Typing the suspend character (typically ^Z, Control-Z) while a process is running causes that process to be stopped and returns control to bash. Typing the delayed suspend character (typically ^Y, Control-Y) causes the process to be stopped when it attempts to read input from the terminal, and control to be returned to bash. The user may then manipulate the state of this job, using the bg command to continue it in the background, the fg command to continue it in the foreground, or the kill command to kill it. A ^Z takes effect immediately, and has the additional side effect of causing pending output and typeahead to be discarded.

There are a number of ways to refer to a job in the shell. The character % introduces a job name. Job number n may be referred to as %n. A job may also be referred to using a prefix of the name used to start it, or using a substring that appears in its command line. For example, %ce refers to a stopped ce job. If a prefix matches more than one job, bash reports an error. Using %?ce, on the other hand, refers to any job containing the string ce in its command line. If the substring matches more than one job, bash reports an error. The symbols %% and %+ refer to the shell's notion of the current job, which is the last job stopped while it was in the foreground or started in the background. The previous job may be referenced using %-. In output pertaining to jobs (e.g., the output of the jobs command), the current job is always flagged with a +, and the previous job with a -. A single % (with no accompanying job specification) also refers to the current job.

Simply naming a job can be used to bring it into the foreground: %1 is a synonym for ``fg %1'', bringing job 1 from the background into the foreground. Similarly, ``%1 &'' resumes job 1 in the background, equivalent to ``bg %1''.

The shell learns immediately whenever a job changes state. Normally, bash waits until it is about to print a prompt before reporting changes in a job's status so as to not interrupt any other output. If the -b option to the set builtin command is enabled, bash reports such changes immediately. Any trap on SIGCHLD is executed for each child that exits.

If an attempt to exit bash is made while jobs are stopped, the shell prints a warning message. The jobs command may then be used to inspect their status. If a second attempt to exit is made without an intervening command, the shell does not print another warning, and the stopped jobs are terminated.  

PROMPTING

When executing interactively, bash displays the primary prompt PS1 when it is ready to read a command, and the secondary prompt PS2 when it needs more input to complete a command. Bash allows these prompt strings to be customized by inserting a number of backslash-escaped special characters that are decoded as follows:
\a
an ASCII bell character (07)
\d
the date in "Weekday Month Date" format (e.g., "Tue May 26")
\D{format}
the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required
\e
an ASCII escape character (033)
\h
the hostname up to the first `.'
\H
the hostname
\j
the number of jobs currently managed by the shell
\l
the basename of the shell's terminal device name
\n
newline
\r
carriage return
\s
the name of the shell, the basename of $0 (the portion following the final slash)
\t
the current time in 24-hour HH:MM:SS format
\T
the current time in 12-hour HH:MM:SS format
\@
the current time in 12-hour am/pm format
\A
the current time in 24-hour HH:MM format
\u
the username of the current user
\v
the version of bash (e.g., 2.00)
\V
the release of bash, version + patch level (e.g., 2.00.0)
\w
the current working directory, with $HOME abbreviated with a tilde
\W
the basename of the current working directory, with $HOME abbreviated with a tilde
\!
the history number of this command
\#
the command number of this command
\$
if the effective UID is 0, a #, otherwise a $
\nnn
the character corresponding to the octal number nnn
\\
a backslash
\[
begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
\]
end a sequence of non-printing characters

The command number and the history number are usually different: the history number of a command is its position in the history list, which may include commands restored from the history file (see HISTORY below), while the command number is the position in the sequence of commands executed during the current shell session. After the string is decoded, it is expanded via parameter expansion, command substitution, arithmetic expansion, and quote removal, subject to the value of the promptvars shell option (see the description of the shopt command under SHELL BUILTIN COMMANDS below).  

READLINE

This is the library that handles reading input when using an interactive shell, unless the --noediting option is given at shell invocation. By default, the line editing commands are similar to those of emacs. A vi-style line editing interface is also available. To turn off line editing after the shell is running, use the +o emacs or +o vi options to the set builtin (see SHELL BUILTIN COMMANDS below).  

Readline Notation

In this section, the emacs-style notation is used to denote keystrokes. Control keys are denoted by C-key, e.g., C-n means Control-N. Similarly, meta keys are denoted by M-key, so M-x means Meta-X. (On keyboards without a meta key, M-x means ESC x, i.e., press the Escape key then the x key. This makes ESC the meta prefix. The combination M-C-x means ESC-Control-x, or press the Escape key then hold the Control key while pressing the x key.)

Readline commands may be given numeric arguments, which normally act as a repeat count. Sometimes, however, it is the sign of the argument that is significant. Passing a negative argument to a command that acts in the forward direction (e.g., kill-line) causes that command to act in a backward direction. Commands whose behavior with arguments deviates from this are noted below.

When a command is described as killing text, the text deleted is saved for possible future retrieval (yanking). The killed text is saved in a kill ring. Consecutive kills cause the text to be accumulated into one unit, which can be yanked all at once. Commands which do not kill text separate the chunks of text on the kill ring.  

Readline Initialization

Readline is customized by putting commands in an initialization file (the inputrc file). The name of this file is taken from the value of the INPUTRC variable. If that variable is unset, the default is ~/.inputrc. When a program which uses the readline library starts up, the initialization file is read, and the key bindings and variables are set. There are only a few basic constructs allowed in the readline initialization file. Blank lines are ignored. Lines beginning with a # are comments. Lines beginning with a $ indicate conditional constructs. Other lines denote key bindings and variable settings.

The default key-bindings may be changed with an inputrc file. Other programs that use this library may add their own commands and bindings.

For example, placing

M-Control-u: universal-argument

or
C-Meta-u: universal-argument
into the inputrc would make M-C-u execute the readline command universal-argument.

The following symbolic character names are recognized: RUBOUT, DEL, ESC, LFD, NEWLINE, RET, RETURN, SPC, SPACE, and TAB.

In addition to command names, readline allows keys to be bound to a string that is inserted when the key is pressed (a macro).  

Readline Key Bindings

The syntax for controlling key bindings in the inputrc file is simple. All that is required is the name of the command or the text of a macro and a key sequence to which it should be bound. The name may be specified in one of two ways: as a symbolic key name, possibly with Meta- or Control- prefixes, or as a key sequence.

When using the form keyname:function-name or macro, keyname is the name of a key spelled out in English. For example:

Control-u: universal-argument
Meta-Rubout: backward-kill-word
Control-o: "> output"

In the above example, C-u is bound to the function universal-argument, M-DEL is bound to the function backward-kill-word, and C-o is bound to run the macro expressed on the right hand side (that is, to insert the text ``> output'' into the line).

In the second form, "keyseq":function-name or macro, keyseq differs from keyname above in that strings denoting an entire key sequence may be specified by placing the sequence within double quotes. Some GNU Emacs style key escapes can be used, as in the following example, but the symbolic character names are not recognized.

"\C-u": universal-argument
"\C-x\C-r": re-read-init-file
"\e[11~": "Function Key 1"

In this example, C-u is again bound to the function universal-argument. C-x C-r is bound to the function re-read-init-file, and ESC [ 1 1 ~ is bound to insert the text ``Function Key 1''.

The full set of GNU Emacs style escape sequences is

\C-
control prefix
\M-
meta prefix
\e
an escape character
\\
backslash
\
literal "
\aq
literal aq

In addition to the GNU Emacs style escape sequences, a second set of backslash escapes is available:

\a
alert (bell)
\b
backspace
\d
delete
\f
form feed
\n
newline
\r
carriage return
\t
horizontal tab
\v
vertical tab
\nnn
the eight-bit character whose value is the octal value nnn (one to three digits)
\xHH
the eight-bit character whose value is the hexadecimal value HH (one or two hex digits)

When entering the text of a macro, single or double quotes must be used to indicate a macro definition. Unquoted text is assumed to be a function name. In the macro body, the backslash escapes described above are expanded. Backslash will quote any other character in the macro text, including " and aq.

Bash allows the current readline key bindings to be displayed or modified with the bind builtin command. The editing mode may be switched during interactive use by using the -o option to the set builtin command (see SHELL BUILTIN COMMANDS below).  

Readline Variables

Readline has variables that can be used to further customize its behavior. A variable may be set in the inputrc file with a statement of the form

set variable-name value

Except where noted, readline variables can take the values On or Off (without regard to case). Unrecognized variable names are ignored. When a variable value is read, empty or null values, "on" (case-insensitive), and "1" are equivalent to On. All other values are equivalent to Off. The variables and their default values are:

bell-style (audible)
Controls what happens when readline wants to ring the terminal bell. If set to none, readline never rings the bell. If set to visible, readline uses a visible bell if one is available. If set to audible, readline attempts to ring the terminal's bell.
bind-tty-special-chars (On)
If set to On, readline attempts to bind the control characters treated specially by the kernel's terminal driver to their readline equivalents.
comment-begin (``#'')
The string that is inserted when the readline insert-comment command is executed. This command is bound to M-# in emacs mode and to # in vi command mode.
completion-ignore-case (Off)
If set to On, readline performs filename matching and completion in a case-insensitive fashion.
completion-query-items (100)
This determines when the user is queried about viewing the number of possible completions generated by the possible-completions command. It may be set to any integer value greater than or equal to zero. If the number of possible completions is greater than or equal to the value of this variable, the user is asked whether or not he wishes to view them; otherwise they are simply listed on the terminal.
convert-meta (On)
If set to On, readline will convert characters with the eighth bit set to an ASCII key sequence by stripping the eighth bit and prefixing an escape character (in effect, using escape as the meta prefix).
disable-completion (Off)
If set to On, readline will inhibit word completion. Completion characters will be inserted into the line as if they had been mapped to self-insert.
editing-mode (emacs)
Controls whether readline begins with a set of key bindings similar to emacs or vi. editing-mode can be set to either emacs or vi.
enable-keypad (Off)
When set to On, readline will try to enable the application keypad when it is called. Some systems need this to enable the arrow keys.
expand-tilde (Off)
If set to on, tilde expansion is performed when readline attempts word completion.
history-preserve-point (Off)
If set to on, the history code attempts to place point at the same location on each history line retrieved with previous-history or next-history.
horizontal-scroll-mode (Off)
When set to On, makes readline use a single line for display, scrolling the input horizontally on a single screen line when it becomes longer than the screen width rather than wrapping to a new line.
input-meta (Off)
If set to On, readline will enable eight-bit input (that is, it will not strip the high bit from the characters it reads), regardless of what the terminal claims it can support. The name meta-flag is a synonym for this variable.
isearch-terminators (``C-[C-J'')
The string of characters that should terminate an incremental search without subsequently executing the character as a command. If this variable has not been given a value, the characters ESC and C-J will terminate an incremental search.
keymap (emacs)
Set the current readline keymap. The set of valid keymap names is emacs, emacs-standard, emacs-meta, emacs-ctlx, vi, vi-command, and vi-insert. vi is equivalent to vi-command; emacs is equivalent to emacs-standard. The default value is emacs; the value of editing-mode also affects the default keymap.
mark-directories (On)
If set to On, completed directory names have a slash appended.
mark-modified-lines (Off)
If set to On, history lines that have been modified are displayed with a preceding asterisk (*).
mark-symlinked-directories (Off)
If set to On, completed names which are symbolic links to directories have a slash appended (subject to the value of mark-directories).
match-hidden-files (On)
This variable, when set to On, causes readline to match files whose names begin with a `.' (hidden files) when performing filename completion, unless the leading `.' is supplied by the user in the filename to be completed.
output-meta (Off)
If set to On, readline will display characters with the eighth bit set directly rather than as a meta-prefixed escape sequence.
page-completions (On)
If set to On, readline uses an internal more-like pager to display a screenful of possible completions at a time.
print-completions-horizontally (Off)
If set to On, readline will display completions with matches sorted horizontally in alphabetical order, rather than down the screen.
show-all-if-ambiguous (Off)
This alters the default behavior of the completion functions. If set to on, words which have more than one possible completion cause the matches to be listed immediately instead of ringing the bell.
show-all-if-unmodified (Off)
This alters the default behavior of the completion functions in a fashion similar to show-all-if-ambiguous. If set to on, words which have more than one possible completion without any possible partial completion (the possible completions don't share a common prefix) cause the matches to be listed immediately instead of ringing the bell.
visible-stats (Off)
If set to On, a character denoting a file's type as reported by stat(2) is appended to the filename when listing possible completions.
 

Readline Conditional Constructs

Readline implements a facility similar in spirit to the conditional compilation features of the C preprocessor which allows key bindings and variable settings to be performed as the result of tests. There are four parser directives used.

$if
The $if construct allows bindings to be made based on the editing mode, the terminal being used, or the application using readline. The text of the test extends to the end of the line; no characters are required to isolate it.
mode
The mode= form of the $if directive is used to test whether readline is in emacs or vi mode. This may be used in conjunction with the set keymap command, for instance, to set bindings in the emacs-standard and emacs-ctlx keymaps only if readline is starting out in emacs mode.
term
The term= form may be used to include terminal-specific key bindings, perhaps to bind the key sequences output by the terminal's function keys. The word on the right side of the = is tested against the both full name of the terminal and the portion of the terminal name before the first -. This allows sun to match both sun and sun-cmd, for instance.
application
The application construct is used to include application-specific settings. Each program using the readline library sets the application name, and an initialization file can test for a particular value. This could be used to bind key sequences to functions useful for a specific program. For instance, the following command adds a key sequence that quotes the current or previous word in Bash:

$if Bash
# Quote the current or previous word
"\C-xq": "\eb\"\ef\""
$endif
$endif
This command, as seen in the previous example, terminates an $if command.
$else
Commands in this branch of the $if directive are executed if the test fails.
$include
This directive takes a single filename as an argument and reads commands and bindings from that file. For example, the following directive would read /etc/inputrc:

$include  /etc/inputrc
 

Searching

Readline provides commands for searching through the command history (see HISTORY below) for lines containing a specified string. There are two search modes: incremental and non-incremental.

Incremental searches begin before the user has finished typing the search string. As each character of the search string is typed, readline displays the next entry from the history matching the string typed so far. An incremental search requires only as many characters as needed to find the desired history entry. The characters present in the value of the isearch-terminators variable are used to terminate an incremental search. If that variable has not been assigned a value the Escape and Control-J characters will terminate an incremental search. Control-G will abort an incremental search and restore the original line. When the search is terminated, the history entry containing the search string becomes the current line.

To find other matching entries in the history list, type Control-S or Control-R as appropriate. This will search backward or forward in the history for the next entry matching the search string typed so far. Any other key sequence bound to a readline command will terminate the search and execute that command. For instance, a newline will terminate the search and accept the line, thereby executing the command from the history list.

Readline remembers the last incremental search string. If two Control-Rs are typed without any intervening characters defining a new search string, any remembered search string is used.

Non-incremental searches read the entire search string before starting to search for matching history lines. The search string may be typed by the user or be part of the contents of the current line.  

Readline Command Names

The following is a list of the names of the commands and the default key sequences to which they are bound. Command names without an accompanying key sequence are unbound by default. In the following descriptions, point refers to the current cursor position, and mark refers to a cursor position saved by the set-mark command. The text between the point and mark is referred to as the region.  

Commands for Moving

beginning-of-line (C-a)
Move to the start of the current line.
end-of-line (C-e)
Move to the end of the line.
forward-char (C-f)
Move forward a character.
backward-char (C-b)
Move back a character.
forward-word (M-f)
Move forward to the end of the next word. Words are composed of alphanumeric characters (letters and digits).
backward-word (M-b)
Move back to the start of the current or previous word. Words are composed of alphanumeric characters (letters and digits).
clear-screen (C-l)
Clear the screen leaving the current line at the top of the screen. With an argument, refresh the current line without clearing the screen.
redraw-current-line
Refresh the current line.
 

Commands for Manipulating the History

accept-line (Newline, Return)
Accept the line regardless of where the cursor is. If this line is non-empty, add it to the history list according to the state of the HISTCONTROL variable. If the line is a modified history line, then restore the history line to its original state.
previous-history (C-p)
Fetch the previous command from the history list, moving back in the list.
next-history (C-n)
Fetch the next command from the history list, moving forward in the list.
beginning-of-history (M-<)
Move to the first line in the history.
end-of-history (M->)
Move to the end of the input history, i.e., the line currently being entered.
reverse-search-history (C-r)
Search backward starting at the current line and moving `up' through the history as necessary. This is an incremental search.
forward-search-history (C-s)
Search forward starting at the current line and moving `down' through the history as necessary. This is an incremental search.
non-incremental-reverse-search-history (M-p)
Search backward through the history starting at the current line using a non-incremental search for a string supplied by the user.
non-incremental-forward-search-history (M-n)
Search forward through the history using a non-incremental search for a string supplied by the user.
history-search-forward
Search forward through the history for the string of characters between the start of the current line and the point. This is a non-incremental search.
history-search-backward
Search backward through the history for the string of characters between the start of the current line and the point. This is a non-incremental search.
yank-nth-arg (M-C-y)
Insert the first argument to the previous command (usually the second word on the previous line) at point. With an argument n, insert the nth word from the previous command (the words in the previous command begin with word 0). A negative argument inserts the nth word from the end of the previous command. Once the argument n is computed, the argument is extracted as if the "!n" history expansion had been specified.
yank-last-arg (M-., M-_)
Insert the last argument to the previous command (the last word of the previous history entry). With an argument, behave exactly like yank-nth-arg. Successive calls to yank-last-arg move back through the history list, inserting the last argument of each line in turn. The history expansion facilities are used to extract the last argument, as if the "!$" history expansion had been specified.
shell-expand-line (M-C-e)
Expand the line as the shell does. This performs alias and history expansion as well as all of the shell word expansions. See HISTORY EXPANSION below for a description of history expansion.
history-expand-line (M-^)
Perform history expansion on the current line. See HISTORY EXPANSION below for a description of history expansion.
magic-space
Perform history expansion on the current line and insert a space. See HISTORY EXPANSION below for a description of history expansion.
alias-expand-line
Perform alias expansion on the current line. See ALIASES above for a description of alias expansion.
history-and-alias-expand-line
Perform history and alias expansion on the current line.
insert-last-argument (M-., M-_)
A synonym for yank-last-arg.
operate-and-get-next (C-o)
Accept the current line for execution and fetch the next line relative to the current line from the history for editing. Any argument is ignored.
edit-and-execute-command (C-xC-e)
Invoke an editor on the current command line, and execute the result as shell commands. Bash attempts to invoke $FCEDIT, $EDITOR, and emacs as the editor, in that order.
 

Commands for Changing Text

delete-char (C-d)
Delete the character at point. If point is at the beginning of the line, there are no characters in the line, and the last character typed was not bound to delete-char, then return EOF.
backward-delete-char (Rubout)
Delete the character behind the cursor. When given a numeric argument, save the deleted text on the kill ring.
forward-backward-delete-char
Delete the character under the cursor, unless the cursor is at the end of the line, in which case the character behind the cursor is deleted.
quoted-insert (C-q, C-v)
Add the next character typed to the line verbatim. This is how to insert characters like C-q, for example.
tab-insert (C-v TAB)
Insert a tab character.
self-insert (a, b, A, 1, !, ...)
Insert the character typed.
transpose-chars (C-t)
Drag the character before point forward over the character at point, moving point forward as well. If point is at the end of the line, then this transposes the two characters before point. Negative arguments have no effect.
transpose-words (M-t)
Drag the word before point past the word after point, moving point over that word as well. If point is at the end of the line, this transposes the last two words on the line.
upcase-word (M-u)
Uppercase the current (or following) word. With a negative argument, uppercase the previous word, but do not move point.
downcase-word (M-l)
Lowercase the current (or following) word. With a negative argument, lowercase the previous word, but do not move point.
capitalize-word (M-c)
Capitalize the current (or following) word. With a negative argument, capitalize the previous word, but do not move point.
overwrite-mode
Toggle overwrite mode. With an explicit positive numeric argument, switches to overwrite mode. With an explicit non-positive numeric argument, switches to insert mode. This command affects only emacs mode; vi mode does overwrite differently. Each call to readline() starts in insert mode. In overwrite mode, characters bound to self-insert replace the text at point rather than pushing the text to the right. Characters bound to backward-delete-char replace the character before point with a space. By default, this command is unbound.
 

Killing and Yanking

kill-line (C-k)
Kill the text from point to the end of the line.
backward-kill-line (C-x Rubout)
Kill backward to the beginning of the line.
unix-line-discard (C-u)
Kill backward from point to the beginning of the line. The killed text is saved on the kill-ring.
kill-whole-line
Kill all characters on the current line, no matter where point is.
kill-word (M-d)
Kill from point to the end of the current word, or if between words, to the end of the next word. Word boundaries are the same as those used by forward-word.
backward-kill-word (M-Rubout)
Kill the word behind point. Word boundaries are the same as those used by backward-word.
unix-word-rubout (C-w)
Kill the word behind point, using white space as a word boundary. The killed text is saved on the kill-ring.
unix-filename-rubout
Kill the word behind point, using white space and the slash character as the word boundaries. The killed text is saved on the kill-ring.
delete-horizontal-space (M-\)
Delete all spaces and tabs around point.
kill-region
Kill the text in the current region.
copy-region-as-kill
Copy the text in the region to the kill buffer.
copy-backward-word
Copy the word before point to the kill buffer. The word boundaries are the same as backward-word.
copy-forward-word
Copy the word following point to the kill buffer. The word boundaries are the same as forward-word.
yank (C-y)
Yank the top of the kill ring into the buffer at point.
yank-pop (M-y)
Rotate the kill ring, and yank the new top. Only works following yank or yank-pop.
 

Numeric Arguments

digit-argument (M-0, M-1, ..., M--)
Add this digit to the argument already accumulating, or start a new argument. M-- starts a negative argument.
universal-argument
This is another way to specify an argument. If this command is followed by one or more digits, optionally with a leading minus sign, those digits define the argument. If the command is followed by digits, executing universal-argument again ends the numeric argument, but is otherwise ignored. As a special case, if this command is immediately followed by a character that is neither a digit or minus sign, the argument count for the next command is multiplied by four. The argument count is initially one, so executing this function the first time makes the argument count four, a second time makes the argument count sixteen, and so on.
 

Completing

complete (TAB)
Attempt to perform completion on the text before point. Bash attempts completion treating the text as a variable (if the text begins with $), username (if the text begins with ~), hostname (if the text begins with @), or command (including aliases and functions) in turn. If none of these produces a match, filename completion is attempted.
possible-completions (M-?)
List the possible completions of the text before point.
insert-completions (M-*)
Insert all completions of the text before point that would have been generated by possible-completions.
menu-complete
Similar to complete, but replaces the word to be completed with a single match from the list of possible completions. Repeated execution of menu-complete steps through the list of possible completions, inserting each match in turn. At the end of the list of completions, the bell is rung (subject to the setting of bell-style) and the original text is restored. An argument of n moves n positions forward in the list of matches; a negative argument may be used to move backward through the list. This command is intended to be bound to TAB, but is unbound by default.
delete-char-or-list
Deletes the character under the cursor if not at the beginning or end of the line (like delete-char). If at the end of the line, behaves identically to possible-completions. This command is unbound by default.
complete-filename (M-/)
Attempt filename completion on the text before point.
possible-filename-completions (C-x /)
List the possible completions of the text before point, treating it as a filename.
complete-username (M-~)
Attempt completion on the text before point, treating it as a username.
possible-username-completions (C-x ~)
List the possible completions of the text before point, treating it as a username.
complete-variable (M-$)
Attempt completion on the text before point, treating it as a shell variable.
possible-variable-completions (C-x $)
List the possible completions of the text before point, treating it as a shell variable.
complete-hostname (M-@)
Attempt completion on the text before point, treating it as a hostname.
possible-hostname-completions (C-x @)
List the possible completions of the text before point, treating it as a hostname.
complete-command (M-!)
Attempt completion on the text before point, treating it as a command name. Command completion attempts to match the text against aliases, reserved words, shell functions, shell builtins, and finally executable filenames, in that order.
possible-command-completions (C-x !)
List the possible completions of the text before point, treating it as a command name.
dynamic-complete-history (M-TAB)
Attempt completion on the text before point, comparing the text against lines from the history list for possible completion matches.
complete-into-braces (M-{)
Perform filename completion and insert the list of possible completions enclosed within braces so the list is available to the shell (see Brace Expansion above).
 

Keyboard Macros

start-kbd-macro (C-x ()
Begin saving the characters typed into the current keyboard macro.
end-kbd-macro (C-x ))
Stop saving the characters typed into the current keyboard macro and store the definition.
call-last-kbd-macro (C-x e)
Re-execute the last keyboard macro defined, by making the characters in the macro appear as if typed at the keyboard.
 

Miscellaneous

re-read-init-file (C-x C-r)
Read in the contents of the inputrc file, and incorporate any bindings or variable assignments found there.
abort (C-g)
Abort the current editing command and ring the terminal's bell (subject to the setting of bell-style).
do-uppercase-version (M-a, M-b, M-x, ...)
If the metafied character x is lowercase, run the command that is bound to the corresponding uppercase character.
prefix-meta (ESC)
Metafy the next character typed. ESC f is equivalent to Meta-f.
undo (C-_, C-x C-u)
Incremental undo, separately remembered for each line.
revert-line (M-r)
Undo all changes made to this line. This is like executing the undo command enough times to return the line to its initial state.
tilde-expand (M-&)
Perform tilde expansion on the current word.
set-mark (C-@, M-<space>)
Set the mark to the point. If a numeric argument is supplied, the mark is set to that position.
exchange-point-and-mark (C-x C-x)
Swap the point with the mark. The current cursor position is set to the saved position, and the old cursor position is saved as the mark.
character-search (C-])
A character is read and point is moved to the next occurrence of that character. A negative count searches for previous occurrences.
character-search-backward (M-C-])
A character is read and point is moved to the previous occurrence of that character. A negative count searches for subsequent occurrences.
insert-comment (M-#)
Without a numeric argument, the value of the readline comment-begin variable is inserted at the beginning of the current line. If a numeric argument is supplied, this command acts as a toggle: if the characters at the beginning of the line do not match the value of comment-begin, the value is inserted, otherwise the characters in comment-begin are deleted from the beginning of the line. In either case, the line is accepted as if a newline had been typed. The default value of comment-begin causes this command to make the current line a shell comment. If a numeric argument causes the comment character to be removed, the line will be executed by the shell.
glob-complete-word (M-g)
The word before point is treated as a pattern for pathname expansion, with an asterisk implicitly appended. This pattern is used to generate a list of matching file names for possible completions.
glob-expand-word (C-x *)
The word before point is treated as a pattern for pathname expansion, and the list of matching file names is inserted, replacing the word. If a numeric argument is supplied, an asterisk is appended before pathname expansion.
glob-list-expansions (C-x g)
The list of expansions that would have been generated by glob-expand-word is displayed, and the line is redrawn. If a numeric argument is supplied, an asterisk is appended before pathname expansion.
dump-functions
Print all of the functions and their key bindings to the readline output stream. If a numeric argument is supplied, the output is formatted in such a way that it can be made part of an inputrc file.
dump-variables
Print all of the settable readline variables and their values to the readline output stream. If a numeric argument is supplied, the output is formatted in such a way that it can be made part of an inputrc file.
dump-macros
Print all of the readline key sequences bound to macros and the strings they output. If a numeric argument is supplied, the output is formatted in such a way that it can be made part of an inputrc file.
display-shell-version (C-x C-v)
Display version information about the current instance of bash.
 

Programmable Completion

When word completion is attempted for an argument to a command for which a completion specification (a compspec) has been defined using the complete builtin (see SHELL BUILTIN COMMANDS below), the programmable completion facilities are invoked.

First, the command name is identified. If a compspec has been defined for that command, the compspec is used to generate the list of possible completions for the word. If the command word is a full pathname, a compspec for the full pathname is searched for first. If no compspec is found for the full pathname, an attempt is made to find a compspec for the portion following the final slash.

Once a compspec has been found, it is used to generate the list of matching words. If a compspec is not found, the default bash completion as described above under Completing is performed.

First, the actions specified by the compspec are used. Only matches which are prefixed by the word being completed are returned. When the -f or -d option is used for filename or directory name completion, the shell variable FIGNORE is used to filter the matches.

Any completions specified by a filename expansion pattern to the -G option are generated next. The words generated by the pattern need not match the word being completed. The GLOBIGNORE shell variable is not used to filter the matches, but the FIGNORE variable is used.

Next, the string specified as the argument to the -W option is considered. The string is first split using the characters in the IFS special variable as delimiters. Shell quoting is honored. Each word is then expanded using brace expansion, tilde expansion, parameter and variable expansion, command substitution, and arithmetic expansion, as described above under EXPANSION. The results are split using the rules described above under Word Splitting. The results of the expansion are prefix-matched against the word being completed, and the matching words become the possible completions.

After these matches have been generated, any shell function or command specified with the -F and -C options is invoked. When the command or function is invoked, the COMP_LINE and COMP_POINT variables are assigned values as described above under Shell Variables. If a shell function is being invoked, the COMP_WORDS and COMP_CWORD variables are also set. When the function or command is invoked, the first argument is the name of the command whose arguments are being completed, the second argument is the word being completed, and the third argument is the word preceding the word being completed on the current command line. No filtering of the generated completions against the word being completed is performed; the function or command has complete freedom in generating the matches.

Any function specified with -F is invoked first. The function may use any of the shell facilities, including the compgen builtin described below, to generate the matches. It must put the possible completions in the COMPREPLY array variable.

Next, any command specified with the -C option is invoked in an environment equivalent to command substitution. It should print a list of completions, one per line, to the standard output. Backslash may be used to escape a newline, if necessary.

After all of the possible completions are generated, any filter specified with the -X option is applied to the list. The filter is a pattern as used for pathname expansion; a & in the pattern is replaced with the text of the word being completed. A literal & may be escaped with a backslash; the backslash is removed before attempting a match. Any completion that matches the pattern will be removed from the list. A leading ! negates the pattern; in this case any completion not matching the pattern will be removed.

Finally, any prefix and suffix specified with the -P and -S options are added to each member of the completion list, and the result is returned to the readline completion code as the list of possible completions.

If the previously-applied actions do not generate any matches, and the -o dirnames option was supplied to complete when the compspec was defined, directory name completion is attempted.

If the -o plusdirs option was supplied to complete when the compspec was defined, directory name completion is attempted and any matches are added to the results of the other actions.

By default, if a compspec is found, whatever it generates is returned to the completion code as the full set of possible completions. The default bash completions are not attempted, and the readline default of filename completion is disabled. If the -o bashdefault option was supplied to complete when the compspec was defined, the bash default completions are attempted if the compspec generates no matches. If the -o default option was supplied to complete when the compspec was defined, readline's default completion will be performed if the compspec (and, if attempted, the default bash completions) generate no matches.

When a compspec indicates that directory name completion is desired, the programmable completion functions force readline to append a slash to completed names which are symbolic links to directories, subject to the value of the mark-directories readline variable, regardless of the setting of the mark-symlinked-directories readline variable.  

HISTORY

When the -o history option to the set builtin is enabled, the shell provides access to the command history, the list of commands previously typed. The value of the HISTSIZE variable is used as the number of commands to save in a history list. The text of the last HISTSIZE commands (default 500) is saved. The shell stores each command in the history list prior to parameter and variable expansion (see EXPANSION above) but after history expansion is performed, subject to the values of the shell variables HISTIGNORE and HISTCONTROL.

On startup, the history is initialized from the file named by the variable HISTFILE (default ~/.bash_history). The file named by the value of HISTFILE is truncated, if necessary, to contain no more than the number of lines specified by the value of HISTFILESIZE. When an interactive shell exits, the last $HISTSIZE lines are copied from the history list to $HISTFILE. If the histappend shell option is enabled (see the description of shopt under SHELL BUILTIN COMMANDS below), the lines are appended to the history file, otherwise the history file is overwritten. If HISTFILE is unset, or if the history file is unwritable, the history is not saved. After saving the history, the history file is truncated to contain no more than HISTFILESIZE lines. If HISTFILESIZE is not set, no truncation is performed.

The builtin command fc (see SHELL BUILTIN COMMANDS below) may be used to list or edit and re-execute a portion of the history list. The history builtin may be used to display or modify the history list and manipulate the history file. When using command-line editing, search commands are available in each editing mode that provide access to the history list.

The shell allows control over which commands are saved on the history list. The HISTCONTROL and HISTIGNORE variables may be set to cause the shell to save only a subset of the commands entered. The cmdhist shell option, if enabled, causes the shell to attempt to save each line of a multi-line command in the same history entry, adding semicolons where necessary to preserve syntactic correctness. The lithist shell option causes the shell to save the command with embedded newlines instead of semicolons. See the description of the shopt builtin below under SHELL BUILTIN COMMANDS for information on setting and unsetting shell options.  

HISTORY EXPANSION

The shell supports a history expansion feature that is similar to the history expansion in csh. This section describes what syntax features are available. This feature is enabled by default for interactive shells, and can be disabled using the +H option to the set builtin command (see SHELL BUILTIN COMMANDS below). Non-interactive shells do not perform history expansion by default.

History expansions introduce words from the history list into the input stream, making it easy to repeat commands, insert the arguments to a previous command into the current input line, or fix errors in previous commands quickly.

History expansion is performed immediately after a complete line is read, before the shell breaks it into words. It takes place in two parts. The first is to determine which line from the history list to use during substitution. The second is to select portions of that line for inclusion into the current one. The line selected from the history is the event, and the portions of that line that are acted upon are words. Various modifiers are available to manipulate the selected words. The line is broken into words in the same fashion as when reading input, so that several metacharacter-separated words surrounded by quotes are considered one word. History expansions are introduced by the appearance of the history expansion character, which is ! by default. Only backslash (\) and single quotes can quote the history expansion character.

Several characters inhibit history expansion if found immediately following the history expansion character, even if it is unquoted: space, tab, newline, carriage return, and =. If the extglob shell option is enabled, ( will also inhibit expansion.

Several shell options settable with the shopt builtin may be used to tailor the behavior of history expansion. If the histverify shell option is enabled (see the description of the shopt builtin), and readline is being used, history substitutions are not immediately passed to the shell parser. Instead, the expanded line is reloaded into the readline editing buffer for further modification. If readline is being used, and the histreedit shell option is enabled, a failed history substitution will be reloaded into the readline editing buffer for correction. The -p option to the history builtin command may be used to see what a history expansion will do before using it. The -s option to the history builtin may be used to add commands to the end of the history list without actually executing them, so that they are available for subsequent recall.

The shell allows control of the various characters used by the history expansion mechanism (see the description of histchars above under Shell Variables).  

Event Designators

An event designator is a reference to a command line entry in the history list.

!
Start a history substitution, except when followed by a blank, newline, carriage return, = or ( (when the extglob shell option is enabled using the shopt builtin).
!n
Refer to command line n.
!-n
Refer to the current command line minus n.
!!
Refer to the previous command. This is a synonym for `!-1'.
!string
Refer to the most recent command starting with string.
!?string[?]
Refer to the most recent command containing string. The trailing ? may be omitted if string is followed immediately by a newline.
^string1^string2^
Quick substitution. Repeat the last command, replacing string1 with string2. Equivalent to ``!!:s/string1/string2/'' (see Modifiers below).
!#
The entire command line typed so far.
 

Word Designators

Word designators are used to select desired words from the event. A : separates the event specification from the word designator. It may be omitted if the word designator begins with a ^, $, *, -, or %. Words are numbered from the beginning of the line, with the first word being denoted by 0 (zero). Words are inserted into the current line separated by single spaces.

0 (zero)
The zeroth word. For the shell, this is the command word.
n
The nth word.
^
The first argument. That is, word 1.
$
The last argument.
%
The word matched by the most recent `?string?' search.
x-y
A range of words; `-y' abbreviates `0-y'.
*
All of the words but the zeroth. This is a synonym for `1-$'. It is not an error to use * if there is just one word in the event; the empty string is returned in that case.
x*
Abbreviates x-$.
x-
Abbreviates x-$ like x*, but omits the last word.

If a word designator is supplied without an event specification, the previous command is used as the event.  

Modifiers

After the optional word designator, there may appear a sequence of one or more of the following modifiers, each preceded by a `:'.

h
Remove a trailing file name component, leaving only the head.
t
Remove all leading file name components, leaving the tail.
r
Remove a trailing suffix of the form .xxx, leaving the basename.
e
Remove all but the trailing suffix.
p
Print the new command but do not execute it.
q
Quote the substituted words, escaping further substitutions.
x
Quote the substituted words as with q, but break into words at blanks and newlines.
s/old/new/
Substitute new for the first occurrence of old in the event line. Any delimiter can be used in place of /. The final delimiter is optional if it is the last character of the event line. The delimiter may be quoted in old and new with a single backslash. If & appears in new, it is replaced by old. A single backslash will quote the &. If old is null, it is set to the last old substituted, or, if no previous history substitutions took place, the last string in a !?string[?] search.
&
Repeat the previous substitution.
g
Cause changes to be applied over the entire event line. This is used in conjunction with `:s' (e.g., `:gs/old/new/') or `:&'. If used with `:s', any delimiter can be used in place of /, and the final delimiter is optional if it is the last character of the event line. An a may be used as a synonym for g.
G
Apply the following `s' modifier once to each word in the event line.
 

SHELL BUILTIN COMMANDS

Unless otherwise noted, each builtin command documented in this section as accepting options preceded by - accepts -- to signify the end of the options. For example, the :, true, false, and test builtins do not accept options.

: [arguments]
No effect; the command does nothing beyond expanding arguments and performing any specified redirections. A zero exit code is returned.
. filename [arguments]
source filename [arguments]
Read and execute commands from filename in the current shell environment and return the exit status of the last command executed from filename. If filename does not contain a slash, file names in PATH are used to find the directory containing filename. The file searched for in PATH need not be executable. When bash is not in posix mode, the current directory is searched if no file is found in PATH. If the sourcepath option to the shopt builtin command is turned off, the PATH is not searched. If any arguments are supplied, they become the positional parameters when filename is executed. Otherwise the positional parameters are unchanged. The return status is the status of the last command exited within the script (0 if no commands are executed), and false if filename is not found or cannot be read.
alias [-p] [name[=value] ...]
Alias with no arguments or with the -p option prints the list of aliases in the form alias name=value on standard output. When arguments are supplied, an alias is defined for each name whose value is given. A trailing space in value causes the next word to be checked for alias substitution when the alias is expanded. For each name in the argument list for which no value is supplied, the name and value of the alias is printed. Alias returns true unless a name is given for which no alias has been defined.
bg [jobspec ...]
Resume each suspended job jobspec in the background, as if it had been started with &. If jobspec is not present, the shell's notion of the current job is used. bg jobspec returns 0 unless run when job control is disabled or, when run with job control enabled, any specified jobspec was not found or was started without job control.
bind [-m keymap] [-lpsvPSV]
bind [-m keymap] [-q function] [-u function] [-r keyseq]
bind [-m keymap] -f filename
bind [-m keymap] -x keyseq:shell-command
bind [-m keymap] keyseq:function-name
bind readline-command
Display current readline key and function bindings, bind a key sequence to a readline function or macro, or set a readline variable. Each non-option argument is a command as it would appear in .inputrc, but each binding or command must be passed as a separate argument; e.g., '"\C-x\C-r": re-read-init-file'. Options, if supplied, have the following meanings:
-m keymap
Use keymap as the keymap to be affected by the subsequent bindings. Acceptable keymap names are emacs, emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move, vi-command, and vi-insert. vi is equivalent to vi-command; emacs is equivalent to emacs-standard.
-l
List the names of all readline functions.
-p
Display readline function names and bindings in such a way that they can be re-read.
-P
List current readline function names and bindings.
-v
Display readline variable names and values in such a way that they can be re-read.
-V
List current readline variable names and values.
-s
Display readline key sequences bound to macros and the strings they output in such a way that they can be re-read.
-S
Display readline key sequences bound to macros and the strings they output.
-f filename
Read key bindings from filename.
-q function
Query about which keys invoke the named function.
-u function
Unbind all keys bound to the named function.
-r keyseq
Remove any current binding for keyseq.
-x keyseq:shell-command
Cause shell-command to be executed whenever keyseq is entered.

The return value is 0 unless an unrecognized option is given or an error occurred.

break [n]
Exit from within a for, while, until, or select loop. If n is specified, break n levels. n must be > 1. If n is greater than the number of enclosing loops, all enclosing loops are exited. The return value is 0 unless the shell is not executing a loop when break is executed.
builtin shell-builtin [arguments]
Execute the specified shell builtin, passing it arguments, and return its exit status. This is useful when defining a function whose name is the same as a shell builtin, retaining the functionality of the builtin within the function. The cd builtin is commonly redefined this way. The return status is false if shell-builtin is not a shell builtin command.
cd [-L|-P] [dir]
Change the current directory to dir. The variable HOME is the default dir. The variable CDPATH defines the search path for the directory containing dir. Alternative directory names in CDPATH are separated by a colon (:). A null directory name in CDPATH is the same as the current directory, i.e., ``.''. If dir begins with a slash (/), then CDPATH is not used. The -P option says to use the physical directory structure instead of following symbolic links (see also the -P option to the set builtin command); the -L option forces symbolic links to be followed. An argument of - is equivalent to $OLDPWD. If a non-empty directory name from CDPATH is used, or if - is the first argument, and the directory change is successful, the absolute pathname of the new working directory is written to the standard output. The return value is true if the directory was successfully changed; false otherwise.
caller [expr]
Returns the context of any active subroutine call (a shell function or a script executed with the . or source builtins. Without expr, caller displays the line number and source filename of the current subroutine call. If a non-negative integer is supplied as expr, caller displays the line number, subroutine name, and source file corresponding to that position in the current execution call stack. This extra information may be used, for example, to print a stack trace. The current frame is frame 0. The return value is 0 unless the shell is not executing a subroutine call or expr does not correspond to a valid position in the call stack.
command [-pVv] command [arg ...]
Run command with args suppressing the normal shell function lookup. Only builtin commands or commands found in the PATH are executed. If the -p option is given, the search for command is performed using a default value for PATH that is guaranteed to find all of the standard utilities. If either the -V or -v option is supplied, a description of command is printed. The -v option causes a single word indicating the command or file name used to invoke command to be displayed; the -V option produces a more verbose description. If the -V or -v option is supplied, the exit status is 0 if command was found, and 1 if not. If neither option is supplied and an error occurred or command cannot be found, the exit status is 127. Otherwise, the exit status of the command builtin is the exit status of command.
compgen [option] [word]
Generate possible completion matches for word according to the options, which may be any option accepted by the complete builtin with the exception of -p and -r, and write the matches to the standard output. When using the -F or -C options, the various shell variables set by the programmable completion facilities, while available, will not have useful values.

The matches will be generated in the same way as if the programmable completion code had generated them directly from a completion specification with the same flags. If word is specified, only those completions matching word will be displayed.

The return value is true unless an invalid option is supplied, or no matches were generated.

complete [-abcdefgjksuv] [-o comp-option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix]

[-X filterpat] [-F function] [-C command] name [name ...]
complete -pr [name ...]
Specify how arguments to each name should be completed. If the -p option is supplied, or if no options are supplied, existing completion specifications are printed in a way that allows them to be reused as input. The -r option removes a completion specification for each name, or, if no names are supplied, all completion specifications.

The process of applying these completion specifications when word completion is attempted is described above under Programmable Completion.

Other options, if specified, have the following meanings. The arguments to the -G, -W, and -X options (and, if necessary, the -P and -S options) should be quoted to protect them from expansion before the complete builtin is invoked.

-o comp-option
The comp-option controls several aspects of the compspec's behavior beyond the simple generation of completions. comp-option may be one of:
bashdefault
Perform the rest of the default bash completions if the compspec generates no matches.
default
Use readline's default filename completion if the compspec generates no matches.
dirnames
Perform directory name completion if the compspec generates no matches.
filenames
Tell readline that the compspec generates filenames, so it can perform any filename-specific processing (like adding a slash to directory names or suppressing trailing spaces). Intended to be used with shell functions.
nospace
Tell readline not to append a space (the default) to words completed at the end of the line.
plusdirs
After any matches defined by the compspec are generated, directory name completion is attempted and any matches are added to the results of the other actions.
-A action
The action may be one of the following to generate a list of possible completions:
alias
Alias names. May also be specified as -a.
arrayvar
Array variable names.
binding
Readline key binding names.
builtin
Names of shell builtin commands. May also be specified as -b.
command
Command names. May also be specified as -c.
directory
Directory names. May also be specified as -d.
disabled
Names of disabled shell builtins.
enabled
Names of enabled shell builtins.
export
Names of exported shell variables. May also be specified as -e.
file
File names. May also be specified as -f.
function
Names of shell functions.
group
Group names. May also be specified as -g.
helptopic
Help topics as accepted by the help builtin.
hostname
Hostnames, as taken from the file specified by the HOSTFILE shell variable.
job
Job names, if job control is active. May also be specified as -j.
keyword
Shell reserved words. May also be specified as -k.
running
Names of running jobs, if job control is active.
service
Service names. May also be specified as -s.
setopt
Valid arguments for the -o option to the set builtin.
shopt
Shell option names as accepted by the shopt builtin.
signal
Signal names.
stopped
Names of stopped jobs, if job control is active.
user
User names. May also be specified as -u.
variable
Names of all shell variables. May also be specified as -v.
-G globpat
The filename expansion pattern globpat is expanded to generate the possible completions.
-W wordlist
The wordlist is split using the characters in the IFS special variable as delimiters, and each resultant word is expanded. The possible completions are the members of the resultant list which match the word being completed.
-C command
command is executed in a subshell environment, and its output is used as the possible completions.
-F function
The shell function function is executed in the current shell environment. When it finishes, the possible completions are retrieved from the value of the COMPREPLY array variable.
-X filterpat
filterpat is a pattern as used for filename expansion. It is applied to the list of possible completions generated by the preceding options and arguments, and each completion matching filterpat is removed from the list. A leading ! in filterpat negates the pattern; in this case, any completion not matching filterpat is removed.
-P prefix
prefix is added at the beginning of each possible completion after all other options have been applied.
-S suffix
suffix is appended to each possible completion after all other options have been applied.

The return value is true unless an invalid option is supplied, an option other than -p or -r is supplied without a name argument, an attempt is made to remove a completion specification for a name for which no specification exists, or an error occurs adding a completion specification.

continue [n]
Resume the next iteration of the enclosing for, while, until, or select loop. If n is specified, resume at the nth enclosing loop. n must be > 1. If n is greater than the number of enclosing loops, the last enclosing loop (the ``top-level'' loop) is resumed. The return value is 0 unless the shell is not executing a loop when continue is executed.
declare [-afFirtx] [-p] [name[=value] ...]
typeset [-afFirtx] [-p] [name[=value] ...]
Declare variables and/or give them attributes. If no names are given then display the values of variables. The -p option will display the attributes and values of each name. When -p is used, additional options are ignored. The -F option inhibits the display of function definitions; only the function name and attributes are printed. If the extdebug shell option is enabled using shopt, the source file name and line number where the function is defined are displayed as well. The -F option implies -f. The following options can be used to restrict output to variables with the specified attribute or to give variables attributes:
-a
Each name is an array variable (see Arrays above).
-f
Use function names only.
-i
The variable is treated as an integer; arithmetic evaluation (see ARITHMETIC EVALUATION ) is performed when the variable is assigned a value.
-r
Make names readonly. These names cannot then be assigned values by subsequent assignment statements or unset.
-t
Give each name the trace attribute. Traced functions inherit the DEBUG and RETURN traps from the calling shell. The trace attribute has no special meaning for variables.
-x
Mark names for export to subsequent commands via the environment.

Using `+' instead of `-' turns off the attribute instead, with the exception that +a may not be used to destroy an array variable. When used in a function, makes each name local, as with the local command. If a variable name is followed by =value, the value of the variable is set to value. The return value is 0 unless an invalid option is encountered, an attempt is made to define a function using ``-f foo=bar'', an attempt is made to assign a value to a readonly variable, an attempt is made to assign a value to an array variable without using the compound assignment syntax (see Arrays above), one of the names is not a valid shell variable name, an attempt is made to turn off readonly status for a readonly variable, an attempt is made to turn off array status for an array variable, or an attempt is made to display a non-existent function with -f.

dirs [-clpv] [+n] [-n]
Without options, displays the list of currently remembered directories. The default display is on a single line with directory names separated by spaces. Directories are added to the list with the pushd command; the popd command removes entries from the list.
+n
Displays the nth entry counting from the left of the list shown by dirs when invoked without options, starting with zero.
-n
Displays the nth entry counting from the right of the list shown by dirs when invoked without options, starting with zero.
-c
Clears the directory stack by deleting all of the entries.
-l
Produces a longer listing; the default listing format uses a tilde to denote the home directory.
-p
Print the directory stack with one entry per line.
-v
Print the directory stack with one entry per line, prefixing each entry with its index in the stack.

The return value is 0 unless an invalid option is supplied or n indexes beyond the end of the directory stack.

disown [-ar] [-h] [jobspec ...]
Without options, each jobspec is removed from the table of active jobs. If the -h option is given, each jobspec is not removed from the table, but is marked so that SIGHUP is not sent to the job if the shell receives a SIGHUP. If no jobspec is present, and neither the -a nor the -r option is supplied, the current job is used. If no jobspec is supplied, the -a option means to remove or mark all jobs; the -r option without a jobspec argument restricts operation to running jobs. The return value is 0 unless a jobspec does not specify a valid job.
echo [-neE] [arg ...]
Output the args, separated by spaces, followed by a newline. The return status is always 0. If -n is specified, the trailing newline is suppressed. If the -e option is given, interpretation of the following backslash-escaped characters is enabled. The -E option disables the interpretation of these escape characters, even on systems where they are interpreted by default. The xpg_echo shell option may be used to dynamically determine whether or not echo expands these escape characters by default. echo does not interpret -- to mean the end of options. echo interprets the following escape sequences:
\a
alert (bell)
\b
backspace
\c
suppress trailing newline
\e
an escape character
\f
form feed
\n
new line
\r
carriage return
\t
horizontal tab
\v
vertical tab
\\
backslash
\0nnn
the eight-bit character whose value is the octal value nnn (zero to three octal digits)
\nnn
the eight-bit character whose value is the octal value nnn (one to three octal digits)
\xHH
the eight-bit character whose value is the hexadecimal value HH (one or two hex digits)
enable [-adnps] [-f filename] [name ...]
Enable and disable builtin shell commands. Disabling a builtin allows a disk command which has the same name as a shell builtin to be executed without specifying a full pathname, even though the shell normally searches for builtins before disk commands. If -n is used, each name is disabled; otherwise, names are enabled. For example, to use the test binary found via the PATH instead of the shell builtin version, run ``enable -n test''. The -f option means to load the new builtin command name from shared object filename, on systems that support dynamic loading. The -d option will delete a builtin previously loaded with -f. If no name arguments are given, or if the -p option is supplied, a list of shell builtins is printed. With no other option arguments, the list consists of all enabled shell builtins. If -n is supplied, only disabled builtins are printed. If -a is supplied, the list printed includes all builtins, with an indication of whether or not each is enabled. If -s is supplied, the output is restricted to the POSIX special builtins. The return value is 0 unless a name is not a shell builtin or there is an error loading a new builtin from a shared object.
eval [arg ...]
The args are read and concatenated together into a single command. This command is then read and executed by the shell, and its exit status is returned as the value of eval. If there are no args, or only null arguments, eval returns 0.
exec [-cl] [-a name] [command [arguments]]
If command is specified, it replaces the shell. No new process is created. The arguments become the arguments to command. If the -l option is supplied, the shell places a dash at the beginning of the zeroth arg passed to command. This is what login(1) does. The -c option causes command to be executed with an empty environment. If -a is supplied, the shell passes name as the zeroth argument to the executed command. If command cannot be executed for some reason, a non-interactive shell exits, unless the shell option execfail is enabled, in which case it returns failure. An interactive shell returns failure if the file cannot be executed. If command is not specified, any redirections take effect in the current shell, and the return status is 0. If there is a redirection error, the return status is 1.
exit [n]
Cause the shell to exit with a status of n. If n is omitted, the exit status is that of the last command executed. A trap on EXIT is executed before the shell terminates.
export [-fn] [name[=word]] ...
export -p
The supplied names are marked for automatic export to the environment of subsequently executed commands. If the -f option is given, the names refer to functions. If no names are given, or if the -p option is supplied, a list of all names that are exported in this shell is printed. The -n option causes the export property to be removed from each name. If a variable name is followed by =word, the value of the variable is set to word. export returns an exit status of 0 unless an invalid option is encountered, one of the names is not a valid shell variable name, or -f is supplied with a name that is not a function.
fc [-e ename] [-nlr] [first] [last]
fc -s [pat=rep] [cmd]
Fix Command. In the first form, a range of commands from first to last is selected from the history list. First and last may be specified as a string (to locate the last command beginning with that string) or as a number (an index into the history list, where a negative number is used as an offset from the current command number). If last is not specified it is set to the current command for listing (so that ``fc -l -10'' prints the last 10 commands) and to first otherwise. If first is not specified it is set to the previous command for editing and -16 for listing.

The -n option suppresses the command numbers when listing. The -r option reverses the order of the commands. If the -l option is given, the commands are listed on standard output. Otherwise, the editor given by ename is invoked on a file containing those commands. If ename is not given, the value of the FCEDIT variable is used, and the value of EDITOR if FCEDIT is not set. If neither variable is set, vi is used. When editing is complete, the edited commands are echoed and executed.

In the second form, command is re-executed after each instance of pat is replaced by rep. A useful alias to use with this is ``r="fc -s"'', so that typing ``r cc'' runs the last command beginning with ``cc'' and typing ``r'' re-executes the last command.

If the first form is used, the return value is 0 unless an invalid option is encountered or first or last specify history lines out of range. If the -e option is supplied, the return value is the value of the last command executed or failure if an error occurs with the temporary file of commands. If the second form is used, the return status is that of the command re-executed, unless cmd does not specify a valid history line, in which case fc returns failure.

fg [jobspec]
Resume jobspec in the foreground, and make it the current job. If jobspec is not present, the shell's notion of the current job is used. The return value is that of the command placed into the foreground, or failure if run when job control is disabled or, when run with job control enabled, if jobspec does not specify a valid job or jobspec specifies a job that was started without job control.
getopts optstring name [args]
getopts is used by shell procedures to parse positional parameters. optstring contains the option characters to be recognized; if a character is followed by a colon, the option is expected to have an argument, which should be separated from it by white space. The colon and question mark characters may not be used as option characters. Each time it is invoked, getopts places the next option in the shell variable name, initializing name if it does not exist, and the index of the next argument to be processed into the variable OPTIND. OPTIND is initialized to 1 each time the shell or a shell script is invoked. When an option requires an argument, getopts places that argument into the variable OPTARG. The shell does not reset OPTIND automatically; it must be manually reset between multiple calls to getopts within the same shell invocation if a new set of parameters is to be used.

When the end of options is encountered, getopts exits with a return value greater than zero. OPTIND is set to the index of the first non-option argument, and name is set to ?.

getopts normally parses the positional parameters, but if more arguments are given in args, getopts parses those instead.

getopts can report errors in two ways. If the first character of optstring is a colon, silent error reporting is used. In normal operation diagnostic messages are printed when invalid options or missing option arguments are encountered. If the variable OPTERR is set to 0, no error messages will be displayed, even if the first character of optstring is not a colon.

If an invalid option is seen, getopts places ? into name and, if not silent, prints an error message and unsets OPTARG. If getopts is silent, the option character found is placed in OPTARG and no diagnostic message is printed.

If a required argument is not found, and getopts is not silent, a question mark (?) is placed in name, OPTARG is unset, and a diagnostic message is printed. If getopts is silent, then a colon (:) is placed in name and OPTARG is set to the option character found.

getopts returns true if an option, specified or unspecified, is found. It returns false if the end of options is encountered or an error occurs.

hash [-lr] [-p filename] [-dt] [name]
For each name, the full file name of the command is determined by searching the directories in $PATH and remembered. If the -p option is supplied, no path search is performed, and filename is used as the full file name of the command. The -r option causes the shell to forget all remembered locations. The -d option causes the shell to forget the remembered location of each name. If the -t option is supplied, the full pathname to which each name corresponds is printed. If multiple name arguments are supplied with -t, the name is printed before the hashed full pathname. The -l option causes output to be displayed in a format that may be reused as input. If no arguments are given, or if only -l is supplied, information about remembered commands is printed. The return status is true unless a name is not found or an invalid option is supplied.
help [-s] [pattern]
Display helpful information about builtin commands. If pattern is specified, help gives detailed help on all commands matching pattern; otherwise help for all the builtins and shell control structures is printed. The -s option restricts the information displayed to a short usage synopsis. The return status is 0 unless no command matches pattern.
history [n]
history -c
history -d offset
history -anrw [filename]
history -p arg [arg ...]
history -s arg [arg ...]
With no options, display the command history list with line numbers. Lines listed with a * have been modified. An argument of n lists only the last n lines. If the shell variable HISTTIMEFORMAT is set and not null, it is used as a format string for strftime(3) to display the time stamp associated with each displayed history entry. No intervening blank is printed between the formatted time stamp and the history line. If filename is supplied, it is used as the name of the history file; if not, the value of HISTFILE is used. Options, if supplied, have the following meanings:
-c
Clear the history list by deleting all the entries.
-d offset
Delete the history entry at position offset.
-a
Append the ``new'' history lines (history lines entered since the beginning of the current bash session) to the history file.
-n
Read the history lines not already read from the history file into the current history list. These are lines appended to the history file since the beginning of the current bash session.
-r
Read the contents of the history file and use them as the current history.
-w
Write the current history to the history file, overwriting the history file's contents.
-p
Perform history substitution on the following args and display the result on the standard output. Does not store the results in the history list. Each arg must be quoted to disable normal history expansion.
-s
Store the args in the history list as a single entry. The last command in the history list is removed before the args are added.

If the HISTTIMEFORMAT is set, the time stamp information associated with each history entry is written to the history file. The return value is 0 unless an invalid option is encountered, an error occurs while reading or writing the history file, an invalid offset is supplied as an argument to -d, or the history expansion supplied as an argument to -p fails.

jobs [-lnprs] [ jobspec ... ]
jobs -x command [ args ... ]
The first form lists the active jobs. The options have the following meanings:
-l
List process IDs in addition to the normal information.
-p
List only the process ID of the job's process group leader.
-n
Display information only about jobs that have changed status since the user was last notified of their status.
-r
Restrict output to running jobs.
-s
Restrict output to stopped jobs.

If jobspec is given, output is restricted to information about that job. The return status is 0 unless an invalid option is encountered or an invalid jobspec is supplied.

If the -x option is supplied, jobs replaces any jobspec found in command or args with the corresponding process group ID, and executes command passing it args, returning its exit status.

kill [-s sigspec | -n signum | -sigspec] [pid | jobspec] ...
kill -l [sigspec | exit_status]
Send the signal named by sigspec or signum to the processes named by pid or jobspec. sigspec is either a case-insensitive signal name such as SIGKILL (with or without the SIG prefix) or a signal number; signum is a signal number. If sigspec is not present, then SIGTERM is assumed. An argument of -l lists the signal names. If any arguments are supplied when -l is given, the names of the signals corresponding to the arguments are listed, and the return status is 0. The exit_status argument to -l is a number specifying either a signal number or the exit status of a process terminated by a signal. kill returns true if at least one signal was successfully sent, or false if an error occurs or an invalid option is encountered.
let arg [arg ...]
Each arg is an arithmetic expression to be evaluated (see ARITHMETICEVALUATION). If the last arg evaluates to 0, let returns 1; 0 is returned otherwise.
local [option] [name[=value] ...]
For each argument, a local variable named name is created, and assigned value. The option can be any of the options accepted by declare. When local is used within a function, it causes the variable name to have a visible scope restricted to that function and its children. With no operands, local writes a list of local variables to the standard output. It is an error to use local when not within a function. The return status is 0 unless local is used outside a function, an invalid name is supplied, or name is a readonly variable.
logout
Exit a login shell.
popd [-n] [+n] [-n]
Removes entries from the directory stack. With no arguments, removes the top directory from the stack, and performs a cd to the new top directory. Arguments, if supplied, have the following meanings:
+n
Removes the nth entry counting from the left of the list shown by dirs, starting with zero. For example: ``popd +0'' removes the first directory, ``popd +1'' the second.
-n
Removes the nth entry counting from the right of the list shown by dirs, starting with zero. For example: ``popd -0'' removes the last directory, ``popd -1'' the next to last.
-n
Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.

If the popd command is successful, a dirs is performed as well, and the return status is 0. popd returns false if an invalid option is encountered, the directory stack is empty, a non-existent directory stack entry is specified, or the directory change fails.

printf [-v var] format [arguments]
Write the formatted arguments to the standard output under the control of the format. The format is a character string which contains three types of objects: plain characters, which are simply copied to standard output, character escape sequences, which are converted and copied to the standard output, and format specifications, each of which causes printing of the next successive argument. In addition to the standard printf(1) formats, %b causes printf to expand backslash escape sequences in the corresponding argument (except that \c terminates output, backslashes in \aq, \", and \? are not removed, and octal escapes beginning with \0 may contain up to four digits), and %q causes printf to output the corresponding argument in a format that can be reused as shell input.

The -v option causes the output to be assigned to the variable var rather than being printed to the standard output.

The format is reused as necessary to consume all of the arguments. If the format requires more arguments than are supplied, the extra format specifications behave as if a zero value or null string, as appropriate, had been supplied. The return value is zero on success, non-zero on failure.

pushd [-n] [dir]
pushd [-n] [+n] [-n]
Adds a directory to the top of the directory stack, or rotates the stack, making the new top of the stack the current working directory. With no arguments, exchanges the top two directories and returns 0, unless the directory stack is empty. Arguments, if supplied, have the following meanings:
+n
Rotates the stack so that the nth directory (counting from the left of the list shown by dirs, starting with zero) is at the top.
-n
Rotates the stack so that the nth directory (counting from the right of the list shown by dirs, starting with zero) is at the top.
-n
Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
dir
Adds dir to the directory stack at the top, making it the new current working directory.

If the pushd command is successful, a dirs is performed as well. If the first form is used, pushd returns 0 unless the cd to dir fails. With the second form, pushd returns 0 unless the directory stack is empty, a non-existent directory stack element is specified, or the directory change to the specified new current directory fails.

pwd [-LP]
Print the absolute pathname of the current working directory. The pathname printed contains no symbolic links if the -P option is supplied or the -o physical option to the set builtin command is enabled. If the -L option is used, the pathname printed may contain symbolic links. The return status is 0 unless an error occurs while reading the name of the current directory or an invalid option is supplied.
read [-ers] [-u fd] [-t timeout] [-a aname] [-p prompt] [-n nchars] [-d delim] [name ...]
One line is read from the standard input, or from the file descriptor fd supplied as an argument to the -u option, and the first word is assigned to the first name, the second word to the second name, and so on, with leftover words and their intervening separators assigned to the last name. If there are fewer words read from the input stream than names, the remaining names are assigned empty values. The characters in IFS are used to split the line into words. The backslash character (\) may be used to remove any special meaning for the next character read and for line continuation. Options, if supplied, have the following meanings:
-a aname
The words are assigned to sequential indices of the array variable aname, starting at 0. aname is unset before any new values are assigned. Other name arguments are ignored.
-d delim
The first character of delim is used to terminate the input line, rather than newline.
-e
If the standard input is coming from a terminal, readline (see READLINE above) is used to obtain the line.
-n nchars
read returns after reading nchars characters rather than waiting for a complete line of input.
-p prompt
Display prompt on standard error, without a trailing newline, before attempting to read any input. The prompt is displayed only if input is coming from a terminal.
-r
Backslash does not act as an escape character. The backslash is considered to be part of the line. In particular, a backslash-newline pair may not be used as a line continuation.
-s
Silent mode. If input is coming from a terminal, characters are not echoed.
-t timeout
Cause read to time out and return failure if a complete line of input is not read within timeout seconds. This option has no effect if read is not reading input from the terminal or a pipe.
-u fd
Read input from file descriptor fd.

If no names are supplied, the line read is assigned to the variable REPLY. The return code is zero, unless end-of-file is encountered, read times out, or an invalid file descriptor is supplied as the argument to -u.

readonly [-apf] [name[=word] ...]
The given names are marked readonly; the values of these names may not be changed by subsequent assignment. If the -f option is supplied, the functions corresponding to the names are so marked. The -a option restricts the variables to arrays. If no name arguments are given, or if the -p option is supplied, a list of all readonly names is printed. The -p option causes output to be displayed in a format that may be reused as input. If a variable name is followed by =word, the value of the variable is set to word. The return status is 0 unless an invalid option is encountered, one of the names is not a valid shell variable name, or -f is supplied with a name that is not a function.
return [n]
Causes a function to exit with the return value specified by n. If n is omitted, the return status is that of the last command executed in the function body. If used outside a function, but during execution of a script by the . (source) command, it causes the shell to stop executing that script and return either n or the exit status of the last command executed within the script as the exit status of the script. If used outside a function and not during execution of a script by ., the return status is false. Any command associated with the RETURN trap is executed before execution resumes after the function or script.
set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
Without options, the name and value of each shell variable are displayed in a format that can be reused as input for setting or resetting the currently-set variables. Read-only variables cannot be reset. In posix mode, only shell variables are listed. The output is sorted according to the current locale. When options are specified, they set or unset shell attributes. Any arguments remaining after the options are processed are treated as values for the positional parameters and are assigned, in order, to $1, $2, ... $n. Options, if specified, have the following meanings:
-a
Automatically mark variables and functions which are modified or created for export to the environment of subsequent commands.
-b
Report the status of terminated background jobs immediately, rather than before the next primary prompt. This is effective only when job control is enabled.
-e
Exit immediately if a simple command (see SHELL GRAMMAR above) exits with a non-zero status. The shell does not exit if the command that fails is part of the command list immediately following a while or until keyword, part of the test in an if statement, part of a && or || list, or if the command's return value is being inverted via !. A trap on ERR, if set, is executed before the shell exits.
-f
Disable pathname expansion.
-h
Remember the location of commands as they are looked up for execution. This is enabled by default.
-k
All arguments in the form of assignment statements are placed in the environment for a command, not just those that precede the command name.
-m
Monitor mode. Job control is enabled. This option is on by default for interactive shells on systems that support it (see JOB CONTROL above). Background processes run in a separate process group and a line containing their exit status is printed upon their completion.
-n
Read commands but do not execute them. This may be used to check a shell script for syntax errors. This is ignored by interactive shells.
-o option-name
The option-name can be one of the following:
allexport
Same as -a.
braceexpand
Same as -B.
emacs
Use an emacs-style command line editing interface. This is enabled by default when the shell is interactive, unless the shell is started with the --noediting option.
errtrace
Same as -E.
functrace
Same as -T.
errexit
Same as -e.
hashall
Same as -h.
histexpand
Same as -H.
history
Enable command history, as described above under HISTORY. This option is on by default in interactive shells.
ignoreeof
The effect is as if the shell command ``IGNOREEOF=10'' had been executed (see Shell Variables above).
keyword
Same as -k.
monitor
Same as -m.
noclobber
Same as -C.
noexec
Same as -n.
noglob
Same as -f. nolog Currently ignored.
notify
Same as -b.
nounset
Same as -u.
onecmd
Same as -t.
physical
Same as -P.
pipefail
If set, the return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands in the pipeline exit successfully. This option is disabled by default.
posix
Change the behavior of bash where the default operation differs from the POSIX 1003.2 standard to match the standard (posix mode).
privileged
Same as -p.
verbose
Same as -v.
vi
Use a vi-style command line editing interface.
xtrace
Same as -x.

If -o is supplied with no option-name, the values of the current options are printed. If +o is supplied with no option-name, a series of set commands to recreate the current option settings is displayed on the standard output.

-p
Turn on privileged mode. In this mode, the $ENV and $BASH_ENV files are not processed, shell functions are not inherited from the environment, and the SHELLOPTS variable, if it appears in the environment, is ignored. If the shell is started with the effective user (group) id not equal to the real user (group) id, and the -p option is not supplied, these actions are taken and the effective user id is set to the real user id. If the -p option is supplied at startup, the effective user id is not reset. Turning this option off causes the effective user and group ids to be set to the real user and group ids.
-t
Exit after reading and executing one command.
-u
Treat unset variables as an error when performing parameter expansion. If expansion is attempted on an unset variable, the shell prints an error message, and, if not interactive, exits with a non-zero status.
-v
Print shell input lines as they are read.
-x
After expanding each simple command, for command, case command, select command, or arithmetic for command, display the expanded value of PS4, followed by the command and its expanded arguments or associated word list.
-B
The shell performs brace expansion (see Brace Expansion above). This is on by default.
-C
If set, bash does not overwrite an existing file with the >, >&, and <> redirection operators. This may be overridden when creating output files by using the redirection operator >| instead of >.
-E
If set, any trap on ERR is inherited by shell functions, command substitutions, and commands executed in a subshell environment. The ERR trap is normally not inherited in such cases.
-H
Enable ! style history substitution. This option is on by default when the shell is interactive.
-P
If set, the shell does not follow symbolic links when executing commands such as cd that change the current working directory. It uses the physical directory structure instead. By default, bash follows the logical chain of directories when performing commands which change the current directory.
-T
If set, any traps on DEBUG and RETURN are inherited by shell functions, command substitutions, and commands executed in a subshell environment. The DEBUG and RETURN traps are normally not inherited in such cases.
--
If no arguments follow this option, then the positional parameters are unset. Otherwise, the positional parameters are set to the args, even if some of them begin with a -.
-
Signal the end of options, cause all remaining args to be assigned to the positional parameters. The -x and -v options are turned off. If there are no args, the positional parameters remain unchanged.

The options are off by default unless otherwise noted. Using + rather than - causes these options to be turned off. The options can also be specified as arguments to an invocation of the shell. The current set of options may be found in $-. The return status is always true unless an invalid option is encountered.

shift [n]
The positional parameters from n+1 ... are renamed to $1 .... Parameters represented by the numbers $# down to $#-n+1 are unset. n must be a non-negative number less than or equal to $#. If n is 0, no parameters are changed. If n is not given, it is assumed to be 1. If n is greater than $#, the positional parameters are not changed. The return status is greater than zero if n is greater than $# or less than zero; otherwise 0.
shopt [-pqsu] [-o] [optname ...]
Toggle the values of variables controlling optional shell behavior. With no options, or with the -p option, a list of all settable options is displayed, with an indication of whether or not each is set. The -p option causes output to be displayed in a form that may be reused as input. Other options have the following meanings:
-s
Enable (set) each optname.
-u
Disable (unset) each optname.
-q
Suppresses normal output (quiet mode); the return status indicates whether the optname is set or unset. If multiple optname arguments are given with -q, the return status is zero if all optnames are enabled; non-zero otherwise.
-o
Restricts the values of optname to be those defined for the -o option to the set builtin.

If either -s or -u is used with no optname arguments, the display is limited to those options which are set or unset, respectively. Unless otherwise noted, the shopt options are disabled (unset) by default.

The return status when listing options is zero if all optnames are enabled, non-zero otherwise. When setting or unsetting options, the return status is zero unless an optname is not a valid shell option.

The list of shopt options is:

cdable_vars
If set, an argument to the cd builtin command that is not a directory is assumed to be the name of a variable whose value is the directory to change to.
cdspell
If set, minor errors in the spelling of a directory component in a cd command will be corrected. The errors checked for are transposed characters, a missing character, and one character too many. If a correction is found, the corrected file name is printed, and the command proceeds. This option is only used by interactive shells.
checkhash
If set, bash checks that a command found in the hash table exists before trying to execute it. If a hashed command no longer exists, a normal path search is performed.
checkwinsize
If set, bash checks the window size after each command and, if necessary, updates the values of LINES and COLUMNS.
cmdhist
If set, bash attempts to save all lines of a multiple-line command in the same history entry. This allows easy re-editing of multi-line commands.
dotglob
If set, bash includes filenames beginning with a `.' in the results of pathname expansion.
execfail
If set, a non-interactive shell will not exit if it cannot execute the file specified as an argument to the exec builtin command. An interactive shell does not exit if exec fails.
expand_aliases
If set, aliases are expanded as described above under ALIASES. This option is enabled by default for interactive shells.
extdebug
If set, behavior intended for use by debuggers is enabled:
1.
The -F option to the declare builtin displays the source file name and line number corresponding to each function name supplied as an argument.
2.
If the command run by the DEBUG trap returns a non-zero value, the next command is skipped and not executed.
3.
If the command run by the DEBUG trap returns a value of 2, and the shell is executing in a subroutine (a shell function or a shell script executed by the . or source builtins), a call to return is simulated.
4.
BASH_ARGC and BASH_ARGV are updated as described in their descriptions above.
5.
Function tracing is enabled: command substitution, shell functions, and subshells invoked with ( command ) inherit the DEBUG and RETURN traps.
6.
Error tracing is enabled: command substitution, shell functions, and subshells invoked with ( command ) inherit the ERROR trap.
extglob
If set, the extended pattern matching features described above under Pathname Expansion are enabled.
extquote
If set, $aqstringaq and $"string" quoting is performed within ${parameter} expansions enclosed in double quotes. This option is enabled by default.
failglob
If set, patterns which fail to match filenames during pathname expansion result in an expansion error.
force_fignore
If set, the suffixes specified by the FIGNORE shell variable cause words to be ignored when performing word completion even if the ignored words are the only possible completions. See SHELL VARIABLES above for a description of FIGNORE. This option is enabled by default.
gnu_errfmt
If set, shell error messages are written in the standard GNU error message format.
histappend
If set, the history list is appended to the file named by the value of the HISTFILE variable when the shell exits, rather than overwriting the file.
histreedit
If set, and readline is being used, a user is given the opportunity to re-edit a failed history substitution.
histverify
If set, and readline is being used, the results of history substitution are not immediately passed to the shell parser. Instead, the resulting line is loaded into the readline editing buffer, allowing further modification.
hostcomplete
If set, and readline is being used, bash will attempt to perform hostname completion when a word containing a @ is being completed (see Completing under READLINE above). This is enabled by default.
huponexit
If set, bash will send SIGHUP to all jobs when an interactive login shell exits.
interactive_comments
If set, allow a word beginning with # to cause that word and all remaining characters on that line to be ignored in an interactive shell (see COMMENTS above). This option is enabled by default.
lithist
If set, and the cmdhist option is enabled, multi-line commands are saved to the history with embedded newlines rather than using semicolon separators where possible.
login_shell
The shell sets this option if it is started as a login shell (see INVOCATION above). The value may not be changed.
mailwarn
If set, and a file that bash is checking for mail has been accessed since the last time it was checked, the message ``The mail in mailfile has been read'' is displayed.
no_empty_cmd_completion
If set, and readline is being used, bash will not attempt to search the PATH for possible completions when completion is attempted on an empty line.
nocaseglob
If set, bash matches filenames in a case-insensitive fashion when performing pathname expansion (see Pathname Expansion above).
nocasematch
If set, bash matches patterns in a case-insensitive fashion when performing matching while executing case or [[ conditional commands.
nullglob
If set, bash allows patterns which match no files (see Pathname Expansion above) to expand to a null string, rather than themselves.
progcomp
If set, the programmable completion facilities (see Programmable Completion above) are enabled. This option is enabled by default.
promptvars
If set, prompt strings undergo parameter expansion, command substitution, arithmetic expansion, and quote removal after being expanded as described in PROMPTING above. This option is enabled by default.
restricted_shell
The shell sets this option if it is started in restricted mode (see RESTRICTED SHELL below). The value may not be changed. This is not reset when the startup files are executed, allowing the startup files to discover whether or not a shell is restricted.
shift_verbose
If set, the shift builtin prints an error message when the shift count exceeds the number of positional parameters.
sourcepath
If set, the source (.) builtin uses the value of PATH to find the directory containing the file supplied as an argument. This option is enabled by default.
xpg_echo
If set, the echo builtin expands backslash-escape sequences by default.
suspend [-f]
Suspend the execution of this shell until it receives a SIGCONT signal. The -f option says not to complain if this is a login shell; just suspend anyway. The return status is 0 unless the shell is a login shell and -f is not supplied, or if job control is not enabled.
test expr
[ expr ]
Return a status of 0 or 1 depending on the evaluation of the conditional expression expr. Each operator and operand must be a separate argument. Expressions are composed of the primaries described above under CONDITIONALEXPRESSIONS. test does not accept any options, nor does it accept and ignore an argument of -- as signifying the end of options.

Expressions may be combined using the following operators, listed in decreasing order of precedence.

! expr
True if expr is false.
( expr )
Returns the value of expr. This may be used to override the normal precedence of operators.
expr1 -a expr2
True if both expr1 and expr2 are true.
expr1 -o expr2
True if either expr1 or expr2 is true.

test and [ evaluate conditional expressions using a set of rules based on the number of arguments.

0 arguments
The expression is false.
1 argument
The expression is true if and only if the argument is not null.
2 arguments
If the first argument is !, the expression is true if and only if the second argument is null. If the first argument is one of the unary conditional operators listed above under CONDITIONALEXPRESSIONS, the expression is true if the unary test is true. If the first argument is not a valid unary conditional operator, the expression is false.
3 arguments
If the second argument is one of the binary conditional operators listed above under CONDITIONALEXPRESSIONS, the result of the expression is the result of the binary test using the first and third arguments as operands. If the first argument is !, the value is the negation of the two-argument test using the second and third arguments. If the first argument is exactly ( and the third argument is exactly ), the result is the one-argument test of the second argument. Otherwise, the expression is false. The -a and -o operators are considered binary operators in this case.
4 arguments
If the first argument is !, the result is the negation of the three-argument expression composed of the remaining arguments. Otherwise, the expression is parsed and evaluated according to precedence using the rules listed above.
5 or more arguments
The expression is parsed and evaluated according to precedence using the rules listed above.
times
Print the accumulated user and system times for the shell and for processes run from the shell. The return status is 0.
trap [-lp] [[arg] sigspec ...]
The command arg is to be read and executed when the shell receives signal(s) sigspec. If arg is absent (and there is a single sigspec) or -, each specified signal is reset to its original disposition (the value it had upon entrance to the shell). If arg is the null string the signal specified by each sigspec is ignored by the shell and by the commands it invokes. If arg is not present and -p has been supplied, then the trap commands associated with each sigspec are displayed. If no arguments are supplied or if only -p is given, trap prints the list of commands associated with each signal. The -l option causes the shell to print a list of signal names and their corresponding numbers. Each sigspec is either a signal name defined in <signal.h>, or a signal number. Signal names are case insensitive and the SIG prefix is optional. If a sigspec is EXIT (0) the command arg is executed on exit from the shell. If a sigspec is DEBUG, the command arg is executed before every simple command, for command, case command, select command, every arithmetic for command, and before the first command executes in a shell function (see SHELL GRAMMAR above). Refer to the description of the extdebug option to the shopt builtin for details of its effect on the DEBUG trap. If a sigspec is ERR, the command arg is executed whenever a simple command has a non-zero exit status, subject to the following conditions. The ERR trap is not executed if the failed command is part of the command list immediately following a while or until keyword, part of the test in an if statement, part of a && or || list, or if the command's return value is being inverted via !. These are the same conditions obeyed by the errexit option. If a sigspec is RETURN, the command arg is executed each time a shell function or a script executed with the . or source builtins finishes executing. Signals ignored upon entry to the shell cannot be trapped or reset. Trapped signals are reset to their original values in a child process when it is created. The return status is false if any sigspec is invalid; otherwise trap returns true.
type [-aftpP] name [name ...]
With no options, indicate how each name would be interpreted if used as a command name. If the -t option is used, type prints a string which is one of alias, keyword, function, builtin, or file if name is an alias, shell reserved word, function, builtin, or disk file, respectively. If the name is not found, then nothing is printed, and an exit status of false is returned. If the -p option is used, type either returns the name of the disk file that would be executed if name were specified as a command name, or nothing if ``type -t name'' would not return file. The -P option forces a PATH search for each name, even if ``type -t name'' would not return file. If a command is hashed, -p and -P print the hashed value, not necessarily the file that appears first in PATH. If the -a option is used, type prints all of the places that contain an executable named name. This includes aliases and functions, if and only if the -p option is not also used. The table of hashed commands is not consulted when using -a. The -f option suppresses shell function lookup, as with the command builtin. type returns true if any of the arguments are found, false if none are found.
ulimit [-SHacdefilmnpqrstuvx [limit]]
Provides control over the resources available to the shell and to processes started by it, on systems that allow such control. The -H and -S options specify that the hard or soft limit is set for the given resource. A hard limit cannot be increased once it is set; a soft limit may be increased up to the value of the hard limit. If neither -H nor -S is specified, both the soft and hard limits are set. The value of limit can be a number in the unit specified for the resource or one of the special values hard, soft, or unlimited, which stand for the current hard limit, the current soft limit, and no limit, respectively. If limit is omitted, the current value of the soft limit of the resource is printed, unless the -H option is given. When more than one resource is specified, the limit name and unit are printed before the value. Other options are interpreted as follows:
-a
All current limits are reported
-c
The maximum size of core files created
-d
The maximum size of a process's data segment
-e
The maximum scheduling priority (`nice')
-f
The maximum size of files created by the shell
-i
The maximum number of pending signals
-l
The maximum size that may be locked into memory
-m
The maximum resident set size
-n
The maximum number of open file descriptors (most systems do not allow this value to be set)
-p
The pipe size in 512-byte blocks (this may not be set)
-q
The maximum number of bytes in POSIX message queues
-r
The maximum rt priority
-s
The maximum stack size
-t
The maximum amount of cpu time in seconds
-u
The maximum number of processes available to a single user
-v
The maximum amount of virtual memory available to the shell
-x
The maximum number of file locks

If limit is given, it is the new value of the specified resource (the -a option is display only). If no option is given, then -f is assumed. Values are in 1024-byte increments, except for -t, which is in seconds, -p, which is in units of 512-byte blocks, and -n and -u, which are unscaled values. The return status is 0 unless an invalid option or argument is supplied, or an error occurs while setting a new limit.

umask [-p] [-S] [mode]
The user file-creation mask is set to mode. If mode begins with a digit, it is interpreted as an octal number; otherwise it is interpreted as a symbolic mode mask similar to that accepted by chmod(1). If mode is omitted, the current value of the mask is printed. The -S option causes the mask to be printed in symbolic form; the default output is an octal number. If the -p option is supplied, and mode is omitted, the output is in a form that may be reused as input. The return status is 0 if the mode was successfully changed or if no mode argument was supplied, and false otherwise.
unalias [-a] [name ...]
Remove each name from the list of defined aliases. If -a is supplied, all alias definitions are removed. The return value is true unless a supplied name is not a defined alias.
unset [-fv] [name ...]
For each name, remove the corresponding variable or function. If no options are supplied, or the -v option is given, each name refers to a shell variable. Read-only variables may not be unset. If -f is specified, each name refers to a shell function, and the function definition is removed. Each unset variable or function is removed from the environment passed to subsequent commands. If any of RANDOM, SECONDS, LINENO, HISTCMD, FUNCNAME, GROUPS, or DIRSTACK are unset, they lose their special properties, even if they are subsequently reset. The exit status is true unless a name is readonly.
wait [n ...]
Wait for each specified process and return its termination status. Each n may be a process ID or a job specification; if a job spec is given, all processes in that job's pipeline are waited for. If n is not given, all currently active child processes are waited for, and the return status is zero. If n specifies a non-existent process or job, the return status is 127. Otherwise, the return status is the exit status of the last process or job waited for.
 

RESTRICTED SHELL

If bash is started with the name rbash, or the -r option is supplied at invocation, the shell becomes restricted. A restricted shell is used to set up an environment more controlled than the standard shell. It behaves identically to bash with the exception that the following are disallowed or not performed:

*
changing directories with cd
*
setting or unsetting the values of SHELL, PATH, ENV, or BASH_ENV
*
specifying command names containing /
*
specifying a file name containing a / as an argument to the . builtin command
*
Specifying a filename containing a slash as an argument to the -p option to the hash builtin command
*
importing function definitions from the shell environment at startup
*
parsing the value of SHELLOPTS from the shell environment at startup
*
redirecting output using the >, >|, <>, >&, &>, and >> redirection operators
*
using the exec builtin command to replace the shell with another command
*
adding or deleting builtin commands with the -f and -d options to the enable builtin command
*
Using the enable builtin command to enable disabled shell builtins
*
specifying the -p option to the command builtin command
*
turning off restricted mode with set +r or set +o restricted.

These restrictions are enforced after any startup files are read.

When a command that is found to be a shell script is executed (see COMMAND EXECUTION above), rbash turns off any restrictions in the shell spawned to execute the script.  

SEE ALSO

Bash Reference Manual, Brian Fox and Chet Ramey
The Gnu Readline Library, Brian Fox and Chet Ramey
The Gnu History Library, Brian Fox and Chet Ramey
Portable Operating System Interface (POSIX) Part 2: Shell and Utilities, IEEE
sh(1), ksh(1), csh(1)
emacs(1), vi(1)
readline(3)
 

FILES

/bin/bash
The bash executable
/etc/profile
The systemwide initialization file, executed for login shells
~/.bash_profile
The personal initialization file, executed for login shells
~/.bashrc
The individual per-interactive-shell startup file
~/.bash_logout
The individual login shell cleanup file, executed when a login shell exits
~/.inputrc
Individual readline initialization file
 

AUTHORS

Brian Fox, Free Software Foundation
bfox@gnu.org

Chet Ramey, Case Western Reserve University
chet@po.cwru.edu  

BUG REPORTS

If you find a bug in bash, you should report it. But first, you should make sure that it really is a bug, and that it appears in the latest version of bash. The latest version is always available from ftp://ftp.gnu.org/pub/bash/.

Once you have determined that a bug actually exists, use the bashbug command to submit a bug report. If you have a fix, you are encouraged to mail that as well! Suggestions and `philosophical' bug reports may be mailed to bug-bash@gnu.org or posted to the Usenet newsgroup gnu.bash.bug.

ALL bug reports should include:

The version number of bash
The hardware and operating system
The compiler used to compile
A description of the bug behaviour
A short script or `recipe' which exercises the bug

bashbug inserts the first three items automatically into the template it provides for filing a bug report.

Comments and bug reports concerning this manual page should be directed to chet@po.cwru.edu.  

BUGS

It's too big and too slow.

There are some subtle differences between bash and traditional versions of sh, mostly because of the POSIX specification.

Aliases are confusing in some uses.

Shell builtin commands and functions are not stoppable/restartable.

Compound commands and command sequences of the form `a ; b ; c' are not handled gracefully when process suspension is attempted. When a process is stopped, the shell immediately executes the next command in the sequence. It suffices to place the sequence of commands between parentheses to force it into a subshell, which may be stopped as a unit.

Commands inside of $(...) command substitution are not parsed until substitution is attempted. This will delay error reporting until some time after the command is entered. For example, unmatched parentheses, even inside shell comments, will result in error messages while the construct is being read.

Array variables may not (yet) be exported.


 

Index

NAME
SYNOPSIS
COPYRIGHT
DESCRIPTION
OPTIONS
ARGUMENTS
INVOCATION
DEFINITIONS
RESERVED WORDS
SHELL GRAMMAR
Simple Commands
Pipelines
Lists
Compound Commands
Shell Function Definitions
COMMENTS
QUOTING
PARAMETERS
Positional Parameters
Special Parameters
Shell Variables
Arrays
EXPANSION
Brace Expansion
Tilde Expansion
Parameter Expansion
Command Substitution
Arithmetic Expansion
Process Substitution
Word Splitting
Pathname Expansion
Quote Removal
REDIRECTION
Redirecting Input
Redirecting Output
Appending Redirected Output
Redirecting Standard Output and Standard Error
Here Documents
Here Strings
Duplicating File Descriptors
Moving File Descriptors
Opening File Descriptors for Reading and Writing
ALIASES
FUNCTIONS
ARITHMETIC EVALUATION
CONDITIONAL EXPRESSIONS
SIMPLE COMMAND EXPANSION
COMMAND EXECUTION
COMMAND EXECUTION ENVIRONMENT
ENVIRONMENT
EXIT STATUS
SIGNALS
JOB CONTROL
PROMPTING
READLINE
Readline Notation
Readline Initialization
Readline Key Bindings
Readline Variables
Readline Conditional Constructs
Searching
Readline Command Names
Commands for Moving
Commands for Manipulating the History
Commands for Changing Text
Killing and Yanking
Numeric Arguments
Completing
Keyboard Macros
Miscellaneous
Programmable Completion
HISTORY
HISTORY EXPANSION
Event Designators
Word Designators
Modifiers
SHELL BUILTIN COMMANDS
RESTRICTED SHELL
SEE ALSO
FILES
AUTHORS
BUG REPORTS
BUGS

This document was created by man2html, using the manual pages.
Time: 01:58:35 GMT, May 26, 2008

Man Muttrc

Content-type: text/html

muttrc

Section: User Manuals (5)
Updated: September 2002

 

NAME

muttrc - Configuration file for the Mutt Mail User Agent  

DESCRIPTION

A mutt configuration file consists of a series of lqcommandsrq. Each line of the file may contain one or more commands. When multiple commands are used, they must be separated by a semicolon (lq;rq).

The hash mark, or pound sign (lq#rq), is used as a lqcommentrq character. You can use it to annotate your initialization file. All text after the comment character to the end of the line is ignored.

Single quotes (lq'rq) and double quotes (lq"rq) can be used to quote strings which contain spaces or other special characters. The difference between the two types of quotes is similar to that of many popular shell programs, namely that a single quote is used to specify a literal string (one that is not interpreted for shell variables or quoting with a backslash [see next paragraph]), while double quotes indicate a string which should be evaluated. For example, backquotes are evaluated inside of double quotes, but not single quotes.

rs quotes the next character, just as in shells such as bash and zsh. For example, if want to put quotes (lq"rq) inside of a string, you can use lqrsrq to force the next character to be a literal instead of interpreted character.

lqrsrsrq means to insert a literal lqrsrq into the line. lqrsnrq and lqrsrrq have their usual C meanings of linefeed and carriage-return, respectively.

A lqrsrq at the end of a line can be used to split commands over multiple lines, provided that the split points don't appear in the middle of command names.

It is also possible to substitute the output of a Unix command in an initialization file. This is accomplished by enclosing the command in backquotes (`command`).

UNIX environment variables can be accessed like the way it is done in shells like sh and bash: Prepend the name of the variable by a dollar (lqDorq) sign.

 

COMMANDS

alias [-group name [...]] key address [, address [ ... ]]
unalias [ *  | key ]
alias defines an alias key for the given addresses. Each address will be resolved into either an email address (user@example.com) or a named email address (User Name <user@example.com>). The address may be specified in either format, or in the format lquser@example.com (User Name)rq. unalias removes the alias corresponding to the given key or all aliases when lq*rq is used as an argument. The optional -group argument to alias causes the aliased address(es) to be added to the named group.

group [-group name] [-rx EXPR [ ... ]] [-addr address [ ... ]]
ungroup [-group name ] [ * | [[-rx EXPR [ ... ]] [-addr address [ ... ]]]
group is used to directly add either addresses or regular expressions to the specified group or groups. The different categories of arguments to the group command can be in any order. The flags -rx and -addr specify what the following strings (that cannot begin with a hyphen) should be interpreted as: either a regular expression or an email address, respectively. ungroup is used to remove addresses or regular expressions from the specified group or groups. The syntax is similar to the group command, however the special character * can be used to empty a group of all of its contents.
These address groups can also be created implicitely by the alias, lists, subscribe and alternates commands by specifying the optional -group option.
Once defined, these address groups can be used in patterns to search for and limit the display to messages matching a group.

alternates [-group name] regexp [ , regexp [ ... ]]
unalternates [ *  | regexp [ , regexp [ ... ]] ]
alternates is used to inform mutt about alternate addresses where you receive mail; you can use regular expressions to specify alternate addresses. This affects mutt's idea about messages from you, and messages addressed to you. unalternates removes a regular expression from the list of known alternates. The -group flag causes all of the subsequent regular expressions to be added to the named group.

alternative_order type[/subtype] [ ... ]
unalternative_order [ *  | type/subtype] [...]
alternative_order command permits you to define an order of preference which is used by mutt to determine which part of a multipart/alternative body to display. A subtype of lq*rq matches any subtype, as does an empty subtype. unalternative_order removes entries from the ordered list or deletes the entire list when lq*rq is used as an argument.

auto_view type[/subtype] [ ... ]
unauto_view type[/subtype] [ ... ]
This commands permits you to specify that mutt should automatically convert the given MIME types to text/plain when displaying messages. For this to work, there must be a mailcap(5) entry for the given MIME type with the copiousoutput flag set. A subtype of lq*rq matches any subtype, as does an empty subtype.

mime_lookup type[/subtype] [ ... ]
unmime_lookup type[/subtype] [ ... ]
This command permits you to define a list of "data" MIME content types for which mutt will try to determine the actual file type from the file name, and not use a mailcap(5) entry given for the original MIME type. For instance, you may add the application/octet-stream MIME type to this list.
bind map1,map2,... key function
This command binds the given key for the given map or maps to the given function. Multiple maps may be specified by separating them with commas (no whitespace is allowed).
Valid maps are: generic, alias, attach, browser, editor, index, compose, pager, pgp, postpone, mix.
For more information on keys and functions, please consult the Mutt Manual.
account-hook [!]regexp command
This hook is executed whenever you access a remote mailbox. Useful to adjust configuration settings to different IMAP or POP servers.
charset-hook alias charset
This command defines an alias for a character set. This is useful to properly display messages which are tagged with a character set name not known to mutt.
iconv-hook charset local-charset
This command defines a system-specific name for a character set. This is useful when your system's iconv(3) implementation does not understand MIME character set names (such as iso-8859-1), but instead insists on being fed with implementation-specific character set names (such as 8859-1). In this specific case, you'd put this into your configuration file:
iconv-hook iso-8859-1 8859-1
message-hook [!]pattern command
Before mutt displays (or formats for replying or forwarding) a message which matches the given pattern (or, when it is preceded by an exclamation mark, does not match the pattern), the given command is executed. When multiple message-hooks match, they are executed in the order in which they occur in the configuration file.
folder-hook [!]regexp command
When mutt enters a folder which matches regexp (or, when regexp is preceded by an exclamation mark, does not match regexp), the given command is executed.
When several folder-hooks match a given mail folder, they are executed in the order given in the configuration file.
macro map key sequence [ description ]
This command binds the given sequence of keys to the given key in the given map or maps. For valid maps, see bind. To specify multiple maps, put only a comma between the maps.

color object foreground background [  regexp ]
color index foreground background [  pattern ]
uncolor index pattern [ pattern ... ]
If your terminal supports color, these commands can be used to assign foreground/backgound combinations to certain objects. Valid objects are: attachment, body, bold, header, hdrdefault, index, indicator, markers, message, normal, quoted, quotedN, search, signature, status, tilde, tree, underline. The body and header objects allow you to restrict the colorization to a regular expression. The index object permits you to select colored messages by pattern.
Valid colors include: white, black, green, magenta, blue, cyan, yellow, red, default, colorN.

mono object attribute [ regexp ]
mono index attribute [ pattern ]
For terminals which don't support color, you can still assign attributes to objects. Valid attributes include: none, bold, underline, reverse, and standout.
[un]ignore pattern [ pattern ... ]
The ignore command permits you to specify header fields which you usually don't wish to see. Any header field whose tag begins with an lqignoredrq pattern will be ignored.
The unignore command permits you to define exceptions from the above mentioned list of ignored headers.

lists [-group name] regexp [ regexp ... ]
unlists regexp [ regexp ... ]
subscribe [-group name] regexp [ regexp ... ]
unsubscribe regexp [ regexp ... ]
Mutt maintains two lists of mailing list address patterns, a list of subscribed mailing lists, and a list of known mailing lists. All subscribed mailing lists are known. Patterns use regular expressions.
The lists command adds a mailing list address to the list of known mailing lists. The unlists command removes a mailing list from the lists of known and subscribed mailing lists. The subscribe command adds a mailing list to the lists of known and subscribed mailing lists. The unsubscribe command removes it from the list of subscribed mailing lists. The -group flag adds all of the subsequent regular expressions to the named group.
mbox-hook [!]pattern mailbox
When mutt changes to a mail folder which matches pattern, mailbox will be used as the lqmboxrq folder, i.e., read messages will be moved to that folder when the mail folder is left.
The first matching mbox-hook applies.

mailboxes filename [ filename ... ]
unmailboxes [ * | filename ... ]
The mailboxes specifies folders which can receive mail and which will be checked for new messages. When changing folders, pressing space will cycle through folders with new mail. The unmailboxes command is used to remove a file name from the list of folders which can receive mail. If "*" is specified as the file name, the list is emptied.

my_hdr string
unmy_hdr field
Using my_hdr, you can define headers which will be added to the messages you compose. unmy_hdr will remove the given user-defined headers.
hdr_order header1 header2 [ ... ]
With this command, you can specify an order in which mutt will attempt to present headers to you when viewing messages.
save-hook [!]pattern filename
When a message matches pattern, the default file name when saving it will be the given filename.
fcc-hook [!]pattern filename
When an outgoing message matches pattern, the default file name for storing a copy (fcc) will be the given filename.
fcc-save-hook [!]pattern filename
This command is an abbreviation for identical fcc-hook and save-hook commands.
send-hook [!]pattern command
When composing a message matching pattern, command is executed. When multiple send-hooks match, they are executed in the order in which they occur in the configuration file.
send2-hook [!]pattern command
Whenever a message matching pattern is changed (either by editing it or by using the compose menu), command is executed. When multiple send2-hooks match, they are executed in the order in which they occur in the configuration file. Possible applications include setting the $sendmail variable when a message's from header is changed.
send2-hook execution is not triggered by use of enter-command from the compose menu.
reply-hook [!]pattern command
When replying to a message matching pattern, command is executed. When multiple reply-hooks match, they are executed in the order in which they occur in the configuration file, but all reply-hooks are matched and executed before send-hooks, regardless of their order in the configuration file.
crypt-hook pattern key-id
The crypt-hook command provides a method by which you can specify the ID of the public key to be used when encrypting messages to a certain recipient. The meaning of "key ID" is to be taken broadly: This can be a different e-mail address, a numerical key ID, or even just an arbitrary search string.
push string
This command adds the named string to the keyboard buffer.

set [no|inv|&|?]variable[=value] [ ... ]
toggle variable [ ... ]
unset variable [ ... ]
reset variable [ ... ]
These commands are used to set and manipulate configuration varibles.
Mutt knows four basic types of variables: boolean, number, string and quadoption. Boolean variables can be set (true), unset (false), or toggled. Number variables can be assigned a positive integer value.
String variables consist of any number of printable characters. Strings must be enclosed in quotes if they contain spaces or tabs. You may also use the lqCrq escape sequences \n and \t for newline and tab, respectively.
Quadoption variables are used to control whether or not to be prompted for certain actions, or to specify a default action. A value of yes will cause the action to be carried out automatically as if you had answered yes to the question. Similarly, a value of no will cause the the action to be carried out as if you had answered lqno.rq A value of ask-yes will cause a prompt with a default answer of lqyesrq and ask-no will provide a default answer of lqno.rq
The reset command resets all given variables to the compile time defaults. If you reset the special variable all, all variables will reset to their compile time defaults.
source filename
The given file will be evaluated as a configuration file.
spam pattern format nospam pattern
These commands define spam-detection patterns from external spam filters, so that mutt can sort, limit, and search on ``spam tags'' or ``spam attributes'', or display them in the index. See the Mutt manual for details.
unhook [ * | hook-type ]
This command will remove all hooks of a given type, or all hooks when lq*rq is used as an argument. hook-type can be any of the -hook commands documented above.
 

PATTERNS

In various places with mutt, including some of the abovementioned hook commands, you can specify patterns to match messages.  

Constructing Patterns

A simple pattern consists of an operator of the form lq~characterrq, possibly followed by a parameter against which mutt is supposed to match the object specified by this operator. For some characters, the ~ may be replaced by another character to alter the behavior of the match. These are described in the list of operators, below.

With some of these operators, the object to be matched consists of several e-mail addresses. In these cases, the object is matched if at least one of these e-mail addresses matches. You can prepend a hat (lq^rq) character to such a pattern to indicate that all addresses must match in order to match the object.

You can construct complex patterns by combining simple patterns with logical operators. Logical AND is specified by simply concatenating two simple patterns, for instance lq~C mutt-dev ~s bugrq. Logical OR is specified by inserting a vertical bar (lq|rq) between two patterns, for instance lq~C mutt-dev | ~s bugrq. Additionally, you can negate a pattern by prepending a bang (lq!rq) character. For logical grouping, use braces (lq()rq). Example: lq!(~t mutt|~c mutt) ~f elkinsrq.  

Simple Patterns

Mutt understands the following simple patterns:

~A
all messages
~b EXPR
messages which contain EXPR in the message body.
=b STRING
messages which contain STRING in the message body. If IMAP is enabled, searches for STRING on the server, rather than downloading each message and searching it locally.
~B EXPR
messages which contain EXPR in the whole message.
~c EXPR
messages carbon-copied to EXPR
%c GROUP
messages carbon-copied to any member of GROUP
~C EXPR
messages either to: or cc: EXPR
%C GROUP
messages either to: or cc: to any member of GROUP
~d MIN-MAX
messages with lqdate-sentrq in a Date range
~D
deleted messages
~e EXPR
messages which contain EXPR in the lqSenderrq field
%e GROUP
messages which contain a member of GROUP in the lqSenderrq field
~E
expired messages
~f EXPR
messages originating from EXPR
%f GROUP
messages originating form any member of GROUP
~F
flagged messages
~g
PGP signed messages
~G
PGP encrypted messages
~h EXPR
messages which contain EXPR in the message header
~H EXPR
messages with spam tags matching EXPR
~i EXPR
messages which match EXPR in the lqMessage-IDrq field
~k
messages containing PGP key material
~l
messages addressed to a known mailing list (defined by either subscribe or list)
~L EXPR
messages either originated or received by EXPR
%L GROUP
messages either originated or received by any member of GROUP
~m MIN-MAX
message in the range MIN to MAX
~n MIN-MAX
messages with a score in the range MIN to MAX
~N
new messages
~O
old messages
~p
messages addressed to you (as defined by alternates)
~P
messages from you (as defined by alternates)
~Q
messages which have been replied to
~r MIN-MAX
messages with lqdate-receivedrq in a Date range
~R
read messages
~s EXPR
messages having EXPR in the lqSubjectrq field.
~S
superseded messages
~t EXPR
messages addressed to EXPR
~T
tagged messages
~u
messages addressed to a subscribed mailing list (defined by subscribe commands)
~U
unread messages
~v
message is part of a collapsed thread.
~V
cryptographically verified messages
~x EXPR
messages which contain EXPR in the lqReferencesrq field
~X MIN-MAX
messages with MIN - MAX attachments
~y EXPR
messages which contain EXPR in the lqX-Labelrq field
~z MIN-MAX
messages with a size in the range MIN to MAX
~=
duplicated messages (see $duplicate_threads)
~$
unreferenced message (requries threaded view)
~(PATTERN)
messages in threads containing messages matching a certain pattern, e.g. all threads containing messages from you: ~(~P)

In the above, EXPR is a regular expression.

With the ~m, ~n, ~X, and ~z operators, you can also specify ranges in the forms <MAX, >MIN, MIN-, and -MAX.  

Matching dates

The ~d and ~r operators are used to match date ranges, which are interpreted to be given in your local time zone.

A date is of the form DD[/MM[/[cc]YY]], that is, a two-digit date, optionally followed by a two-digit month, optionally followed by a year specifications. Omitted fields default to the current month and year.

Mutt understands either two or four digit year specifications. When given a two-digit year, mutt will interpret values less than 70 as lying in the 21st century (i.e., lq38rq means 2038 and not 1938, and lq00rq is interpreted as 2000), and values greater than or equal to 70 as lying in the 20th century.

Note that this behaviour is Y2K compliant, but that mutt does have a Y2.07K problem.

If a date range consists of a single date, the operator in question will match that precise date. If the date range consists of a dash (lq-rq), followed by a date, this range will match any date before and up to the date given. Similarly, a date followed by a dash matches the date given and any later point of time. Two dates, separated by a dash, match any date which lies in the given range of time.

You can also modify any absolute date by giving an error range. An error range consists of one of the characters +, -, *, followed by a positive number, followed by one of the unit characters y, m, w, or d, specifying a unit of years, months, weeks, or days. + increases the maximum date matched by the given interval of time, - decreases the minimum date matched by the given interval of time, and * increases the maximum date and decreases the minimum date matched by the given interval of time. It is possible to give multiple error margins, which cumulate. Example: 1/1/2001-1w+2w*3d

You can also specify offsets relative to the current date. An offset is specified as one of the characters <, >, =, followed by a positive number, followed by one of the unit characters y, m, w, or d. > matches dates which are older than the specified amount of time, an offset which begins with the character < matches dates which are more recent than the specified amount of time, and an offset which begins with the character = matches points of time which are precisely the given amount of time ago.  

CONFIGURATION VARIABLES

abort_nosubject
Type: quadoption
Default: ask-yes
If set to yes, when composing messages and no subject is given at the subject prompt, composition will be aborted. If set to no, composing messages with no subject given at the subject prompt will never be aborted.

abort_unmodified
Type: quadoption
Default: yes
If set to yes, composition will automatically abort after editing the message body if no changes are made to the file (this check only happens after the first edit of the file). When set to no, composition will never be aborted.

alias_file
Type: path
Default: lq~/.muttrcrq
The default file in which to save aliases created by the lqcreate-aliasrq function.
Note: Mutt will not automatically source this file; you must explicitly use the lqsourcerq command for it to be executed.
The default for this option is the currently used muttrc file, or lq~/.muttrcrq if no user muttrc was found.

alias_format
Type: string
Default: lq%4n %2f %t %-10a   %rrq
Specifies the format of the data displayed for the `alias' menu. The following printf(3)-style sequences are available:
%a
alias name
%f
flags - currently, a rqdrq for an alias marked for deletion
%n
index number
%r
address which alias expands to
%t
character which indicates if the alias is tagged for inclusion

allow_8bit
Type: boolean
Default: yes
Controls whether 8-bit data is converted to 7-bit using either Quoted- Printable or Base64 encoding when sending mail.

allow_ansi
Type: boolean
Default: no
Controls whether ANSI color codes in messages (and color tags in rich text messages) are to be interpreted. Messages containing these codes are rare, but if this option is set, their text will be colored accordingly. Note that this may override your color choices, and even present a security problem, since a message could include a line like rq[-- PGP output follows ...rq and give it the same color as your attachment color.

arrow_cursor
Type: boolean
Default: no
When set, an arrow (lq->rq) will be used to indicate the current entry in menus instead of highlighting the whole line. On slow network or modem links this will make response faster because there is less that has to be redrawn on the screen when moving to the next or previous entries in the menu.

ascii_chars
Type: boolean
Default: no
If set, Mutt will use plain ASCII characters when displaying thread and attachment trees, instead of the default ACS characters.

askbcc
Type: boolean
Default: no
If set, Mutt will prompt you for blind-carbon-copy (Bcc) recipients before editing an outgoing message.

askcc
Type: boolean
Default: no
If set, Mutt will prompt you for carbon-copy (Cc) recipients before editing the body of an outgoing message.

assumed_charset
Type: string
Default: lqrq
This variable is a colon-separated list of character encoding schemes for messages without character encoding indication. Header field values and message body content without character encoding indication would be assumed that they are written in one of this list. By default, all the header fields and message body without any charset indication are assumed to be in rqus-asciirq.
For example, Japanese users might prefer this:
set assumed_charset=rqiso-2022-jp:euc-jp:shift_jis:utf-8rq
However, only the first content is valid for the message body.

attach_charset
Type: string
Default: lqrq
This variable is a colon-separated list of character encoding schemes for text file attachments. If unset, $charset value will be used instead. For example, the following configuration would work for Japanese text handling:
set attach_charset=rqiso-2022-jp:euc-jp:shift_jis:utf-8rq
Note: rqiso-2022-*rq must be put at the head of the value as shown above if included.

attach_format
Type: string
Default: lq%u%D%I %t%4n %T%.40d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] rq
This variable describes the format of the `attachment' menu. The following printf-style sequences are understood:
%C
charset
%c
requires charset conversion (n or c)
%D
deleted flag
%d
description
%e
MIME content-transfer-encoding
%f
filename
%I
disposition (I=inline, A=attachment)
%m
major MIME type
%M
MIME subtype
%n
attachment number
%Q
rqQrq, if MIME part qualifies for attachment counting
%s
size
%t
tagged flag
%T
graphic tree characters
%u
unlink (=to delete) flag
%X
number of qualifying MIME parts in this part and its children (please see the lqattachmentsrq section for possible speed effects)
%>X
right justify the rest of the string and pad with character rqXrq
%|X
pad to the end of the line with character rqXrq
%*X
soft-fill with character rqXrq as pad
For an explanation of `soft-fill', see the lq$index_formatrq documentation.

attach_sep
Type: string
Default: lq\nrq
The separator to add between attachments when operating (saving, printing, piping, etc) on a list of tagged attachments.

attach_split
Type: boolean
Default: yes
If this variable is unset, when operating (saving, printing, piping, etc) on a list of tagged attachments, Mutt will concatenate the attachments and will operate on them as a single attachment. The lq$attach_seprq separator is added after each attachment. When set, Mutt will operate on the attachments one by one.

attribution
Type: string
Default: lqOn %d, %n wrote:rq
This is the string that will precede a message which has been included in a reply. For a full listing of defined printf()-like sequences see the section on lq$index_formatrq.

autoedit
Type: boolean
Default: no
When set along with lq$edit_headersrq, Mutt will skip the initial send-menu and allow you to immediately begin editing the body of your message. The send-menu may still be accessed once you have finished editing the body of your message.
Also see lq$fast_replyrq.

auto_tag
Type: boolean
Default: no
When set, functions in the index menu which affect a message will be applied to all tagged messages (if there are any). When unset, you must first use the tag-prefix function (default: rq;rq) to make the next function apply to all tagged messages.

beep
Type: boolean
Default: yes
When this variable is set, mutt will beep when an error occurs.

beep_new
Type: boolean
Default: no
When this variable is set, mutt will beep whenever it prints a message notifying you of new mail. This is independent of the setting of the lq$beeprq variable.

bounce
Type: quadoption
Default: ask-yes
Controls whether you will be asked to confirm bouncing messages. If set to yes you don't get asked if you want to bounce a message. Setting this variable to no is not generally useful, and thus not recommended, because you are unable to bounce messages.

bounce_delivered
Type: boolean
Default: yes
When this variable is set, mutt will include Delivered-To headers when bouncing messages. Postfix users may wish to unset this variable.

braille_friendly
Type: boolean
Default: no
When this variable is set, mutt will place the cursor at the beginning of the current line in menus, even when the arrow_cursor variable is unset, making it easier for blind persons using Braille displays to follow these menus. The option is disabled by default because many visual terminals don't permit making the cursor invisible.

check_mbox_size
Type: boolean
Default: no
When this variable is set, mutt will use file size attribute instead of access time when checking for new mail.

charset
Type: string
Default: lqrq
Character set your terminal uses to display and enter textual data. It is also the fallback for $send_charset.

check_new
Type: boolean
Default: yes
Note: this option only affects maildir and MH style mailboxes.
When set, Mutt will check for new mail delivered while the mailbox is open. Especially with MH mailboxes, this operation can take quite some time since it involves scanning the directory and checking each file to see if it has already been looked at. If check_new is unset, no check for new mail is performed while the mailbox is open.

collapse_unread
Type: boolean
Default: yes
When unset, Mutt will not collapse a thread if it contains any unread messages.

uncollapse_jump
Type: boolean
Default: no
When set, Mutt will jump to the next unread message, if any, when the current thread is uncollapsed.

compose_format
Type: string
Default: lq-- Mutt: Compose  [Approx. msg size: %l   Atts: %a]%>-rq
Controls the format of the status line displayed in the Compose menu. This string is similar to lq$status_formatrq, but has its own set of printf()-like sequences:
%a
total number of attachments
%h
local hostname
%l
approximate size (in bytes) of the current message
%v
Mutt version string
See the text describing the lq$status_formatrq option for more information on how to set lq$compose_formatrq.

config_charset
Type: string
Default: lqrq
When defined, Mutt will recode commands in rc files from this encoding.

confirmappend
Type: boolean
Default: yes
When set, Mutt will prompt for confirmation when appending messages to an existing mailbox.

confirmcreate
Type: boolean
Default: yes
When set, Mutt will prompt for confirmation when saving messages to a mailbox which does not yet exist before creating it.

connect_timeout
Type: number
Default: 30
Causes Mutt to timeout a network connection (for IMAP or POP) after this many seconds if the connection is not able to be established. A negative value causes Mutt to wait indefinitely for the connection to succeed.

content_type
Type: string
Default: lqtext/plainrq
Sets the default Content-Type for the body of newly composed messages.

copy
Type: quadoption
Default: yes
This variable controls whether or not copies of your outgoing messages will be saved for later references. Also see lq$recordrq, lq$save_namerq, lq$force_namerq and lqfcc-hookrq.

crypt_use_gpgme
Type: boolean
Default: no
This variable controls the use of the GPGME-enabled crypto backends. If it is set and Mutt was built with gpgme support, the gpgme code for S/MIME and PGP will be used instead of the classic code. Note that you need to set this option in .muttrc; it won't have any effect when used interactively.

crypt_use_pka
Type: boolean
Default: no
(http://www.g10code.de/docs/pka-intro.de.pdf) during signature verification (only supported by the GPGME backend).

crypt_autopgp
Type: boolean
Default: yes
This variable controls whether or not mutt may automatically enable PGP encryption/signing for messages. See also lq$crypt_autoencryptrq, lq$crypt_replyencryptrq, lq$crypt_autosignrq, lq$crypt_replysignrq and lq$smime_is_defaultrq.

crypt_autosmime
Type: boolean
Default: yes
This variable controls whether or not mutt may automatically enable S/MIME encryption/signing for messages. See also lq$crypt_autoencryptrq, lq$crypt_replyencryptrq, lq$crypt_autosignrq, lq$crypt_replysignrq and lq$smime_is_defaultrq.

date_format
Type: string
Default: lq!%a, %b %d, %Y at %I:%M:%S%p %Zrq
This variable controls the format of the date printed by the lq%drq sequence in lq$index_formatrq. This is passed to the strftime call to process the date. See the man page for strftime(3) for the proper syntax.
Unless the first character in the string is a bang (lq!rq), the month and week day names are expanded according to the locale specified in the variable lq$localerq. If the first character in the string is a bang, the bang is discarded, and the month and week day names in the rest of the string are expanded in the C locale (that is in US English).

default_hook
Type: string
Default: lq~f %s !~P | (~P ~C %s)rq
This variable controls how message-hooks, reply-hooks, send-hooks, send2-hooks, save-hooks, and fcc-hooks will be interpreted if they are specified with only a simple regexp, instead of a matching pattern. The hooks are expanded when they are declared, so a hook will be interpreted according to the value of this variable at the time the hook is declared. The default value matches if the message is either from a user matching the regular expression given, or if it is from you (if the from address matches lqalternatesrq) and is to or cc'ed to a user matching the given regular expression.

delete
Type: quadoption
Default: ask-yes
Controls whether or not messages are really deleted when closing or synchronizing a mailbox. If set to yes, messages marked for deleting will automatically be purged without prompting. If set to no, messages marked for deletion will be kept in the mailbox.

delete_untag
Type: boolean
Default: yes
If this option is set, mutt will untag messages when marking them for deletion. This applies when you either explicitly delete a message, or when you save it to another folder.

digest_collapse
Type: boolean
Default: yes
If this option is set, mutt's received-attachments menu will not show the subparts of individual messages in a multipart/digest. To see these subparts, press 'v' on that menu.

display_filter
Type: path
Default: lqrq
When set, specifies a command used to filter messages. When a message is viewed it is passed as standard input to $display_filter, and the filtered message is read from the standard output.

dsn_notify
Type: string
Default: lqrq
Note: you should not enable this unless you are using Sendmail 8.8.x or greater.
This variable sets the request for when notification is returned. The string consists of a comma separated list (no spaces!) of one or more of the following: never, to never request notification, failure, to request notification on transmission failure, delay, to be notified of message delays, success, to be notified of successful transmission.
Example: set dsn_notify=rqfailure,delayrq

dsn_return
Type: string
Default: lqrq
Note: you should not enable this unless you are using Sendmail 8.8.x or greater.
This variable controls how much of your message is returned in DSN messages. It may be set to either hdrs to return just the message header, or full to return the full message.
Example: set dsn_return=hdrs

duplicate_threads
Type: boolean
Default: yes
This variable controls whether mutt, when sorting by threads, threads messages with the same message-id together. If it is set, it will indicate that it thinks they are duplicates of each other with an equals sign in the thread diagram.

edit_headers
Type: boolean
Default: no
This option allows you to edit the header of your outgoing messages along with the body of your message.

editor
Type: path
Default: lqrq
This variable specifies which editor is used by mutt. It defaults to the value of the VISUAL, or EDITOR, environment variable, or to the string rqvirq if neither of those are set.

encode_from
Type: boolean
Default: no
When set, mutt will quoted-printable encode messages when they contain the string rqFrom rq in the beginning of a line. Useful to avoid the tampering certain mail delivery and transport agents tend to do with messages.

envelope_from_address
Type: e-mail address
Default: lqrq
Manually sets the envelope sender for outgoing messages. This value is ignored if lq$use_envelope_fromrq is unset.

escape
Type: string
Default: lq~rq
Escape character to use for functions in the builtin editor.

fast_reply
Type: boolean
Default: no
When set, the initial prompt for recipients and subject are skipped when replying to messages, and the initial prompt for subject is skipped when forwarding messages.
Note: this variable has no effect when the lq$autoeditrq variable is set.

fcc_attach
Type: boolean
Default: yes
This variable controls whether or not attachments on outgoing messages are saved along with the main body of your message.

fcc_clear
Type: boolean
Default: no
When this variable is set, FCCs will be stored unencrypted and unsigned, even when the actual message is encrypted and/or signed. (PGP only)

folder
Type: path
Default: lq~/Mailrq
Specifies the default location of your mailboxes. A `+' or `=' at the beginning of a pathname will be expanded to the value of this variable. Note that if you change this variable from the default value you need to make sure that the assignment occurs before you use `+' or `=' for any other variables since expansion takes place during the `set' command.

folder_format
Type: string
Default: lq%2C %t %N %F %2l %-8.8u %-8.8g %8s %d %frq
This variable allows you to customize the file browser display to your personal taste. This string is similar to lq$index_formatrq, but has its own set of printf()-like sequences:
%C
current file number
%d
date/time folder was last modified
%f
filename
%F
file permissions
%g
group name (or numeric gid, if missing)
%l
number of hard links
%N
N if folder has new mail, blank otherwise
%s
size in bytes
%t
* if the file is tagged, blank otherwise
%u
owner name (or numeric uid, if missing)
%>X
right justify the rest of the string and pad with character rqXrq
%|X
pad to the end of the line with character rqXrq
%*X
soft-fill with character rqXrq as pad
For an explanation of `soft-fill', see the lq$index_formatrq documentation.

followup_to
Type: boolean
Default: yes
Controls whether or not the Mail-Followup-To header field is generated when sending mail. When set, Mutt will generate this field when you are replying to a known mailing list, specified with the lqsubscriberq or lqlistsrq commands.
This field has two purposes. First, preventing you from receiving duplicate copies of replies to messages which you send to mailing lists, and second, ensuring that you do get a reply separately for any messages sent to known lists to which you are not subscribed. The header will contain only the list's address for subscribed lists, and both the list address and your own email address for unsubscribed lists. Without this header, a group reply to your message sent to a subscribed list will be sent to both the list and your address, resulting in two copies of the same email for you.

force_name
Type: boolean
Default: no
This variable is similar to lq$save_namerq, except that Mutt will store a copy of your outgoing message by the username of the address you are sending to even if that mailbox does not exist.
Also see the lq$recordrq variable.

forward_decode
Type: boolean
Default: yes
Controls the decoding of complex MIME messages into text/plain when forwarding a message. The message header is also RFC2047 decoded. This variable is only used, if lq$mime_forwardrq is unset, otherwise lq$mime_forward_decoderq is used instead.

forward_edit
Type: quadoption
Default: yes
This quadoption controls whether or not the user is automatically placed in the editor when forwarding messages. For those who always want to forward with no modification, use a setting of lqnorq.

forward_format
Type: string
Default: lq[%a: %s]rq
This variable controls the default subject when forwarding a message. It uses the same format sequences as the lq$index_formatrq variable.

forward_quote
Type: boolean
Default: no
When set forwarded messages included in the main body of the message (when lq$mime_forwardrq is unset) will be quoted using lq$indent_stringrq.

from
Type: e-mail address
Default: lqrq
When set, this variable contains a default from address. It can be overridden using my_hdr (including from send-hooks) and lq$reverse_namerq. This variable is ignored if lq$use_fromrq is unset.
Defaults to the contents of the environment variable EMAIL.

gecos_mask
Type: regular expression
Default: lq^[^,]*rq
A regular expression used by mutt to parse the GECOS field of a password entry when expanding the alias. By default the regular expression is set to rq^[^,]*rq which will return the string up to the first rq,rq encountered. If the GECOS field contains a string like rqlastname, firstnamerq then you should set the gecos_mask=rq.*rq.
This can be useful if you see the following behavior: you address a e-mail to user ID stevef whose full name is Steve Franklin. If mutt expands stevef to rqFranklinrq stevef@foo.bar then you should set the gecos_mask to a regular expression that will match the whole name so mutt will expand rqFranklinrq to rqFranklin, Steverq.

hdrs
Type: boolean
Default: yes
When unset, the header fields normally added by the lqmy_hdrrq command are not created. This variable must be unset before composing a new message or replying in order to take effect. If set, the user defined header fields are added to every new message.

header
Type: boolean
Default: no
When set, this variable causes Mutt to include the header of the message you are replying to into the edit buffer. The lq$weedrq setting applies.

help
Type: boolean
Default: yes
When set, help lines describing the bindings for the major functions provided by each menu are displayed on the first line of the screen.
Note: The binding will not be displayed correctly if the function is bound to a sequence rather than a single keystroke. Also, the help line may not be updated if a binding is changed while Mutt is running. Since this variable is primarily aimed at new users, neither of these should present a major problem.

hidden_host
Type: boolean
Default: no
When set, mutt will skip the host name part of lq$hostnamerq variable when adding the domain part to addresses. This variable does not affect the generation of Message-IDs, and it will not lead to the cut-off of first-level domains.

hide_limited
Type: boolean
Default: no
When set, mutt will not show the presence of messages that are hidden by limiting, in the thread tree.

hide_missing
Type: boolean
Default: yes
When set, mutt will not show the presence of missing messages in the thread tree.

hide_thread_subject
Type: boolean
Default: yes
When set, mutt will not show the subject of messages in the thread tree that have the same subject as their parent or closest previously displayed sibling.

hide_top_limited
Type: boolean
Default: no
When set, mutt will not show the presence of messages that are hidden by limiting, at the top of threads in the thread tree. Note that when $hide_limited is set, this option will have no effect.

hide_top_missing
Type: boolean
Default: yes
When set, mutt will not show the presence of missing messages at the top of threads in the thread tree. Note that when $hide_missing is set, this option will have no effect.

history
Type: number
Default: 10
This variable controls the size (in number of strings remembered) of the string history buffer. The buffer is cleared each time the variable is set.

history_file
Type: path
Default: lq~/.mutthistoryrq
The file in which Mutt will save its history.

honor_followup_to
Type: quadoption
Default: yes
This variable controls whether or not a Mail-Followup-To header is honored when group-replying to a message.

hostname
Type: string
Default: lqrq
Specifies the hostname to use after the lq@rq in local e-mail addresses. This overrides the compile time definition obtained from /etc/resolv.conf.

ignore_linear_white_space
Type: boolean
Default: no
This option replaces linear-white-space between encoded-word and *text to a single space to prevent the display of MIME-encoded lqSubjectrq field from being divided into multiple lines.

ignore_list_reply_to
Type: boolean
Default: no
Affects the behaviour of the reply function when replying to messages from mailing lists. When set, if the lqReply-To:rq field is set to the same value as the lqTo:rq field, Mutt assumes that the lqReply-To:rq field was set by the mailing list to automate responses to the list, and will ignore this field. To direct a response to the mailing list when this option is set, use the list-reply function; group-reply will reply to both the sender and the list.

imap_authenticators
Type: string
Default: lqrq
This is a colon-delimited list of authentication methods mutt may attempt to use to log in to an IMAP server, in the order mutt should try them. Authentication methods are either 'login' or the right side of an IMAP 'AUTH=xxx' capability string, eg 'digest-md5', 'gssapi' or 'cram-md5'. This parameter is case-insensitive. If this parameter is unset (the default) mutt will try all available methods, in order from most-secure to least-secure.
Example: set imap_authenticators=rqgssapi:cram-md5:loginrq
Note: Mutt will only fall back to other authentication methods if the previous methods are unavailable. If a method is available but authentication fails, mutt will not connect to the IMAP server.

imap_check_subscribed
Type: boolean
Default: no
When set, mutt will fetch the set of subscribed folders from your server on connection, and add them to the set of mailboxes it polls for new mail. See also the lqmailboxesrq command.

imap_delim_chars
Type: string
Default: lq/.rq
This contains the list of characters which you would like to treat as folder separators for displaying IMAP paths. In particular it helps in using the '=' shortcut for your folder variable.

imap_headers
Type: string
Default: lqrq
Mutt requests these header fields in addition to the default headers (rqDATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES X-LABELrq) from IMAP servers before displaying the index menu. You may want to add more headers for spam detection. Note: This is a space separated list.

imap_idle
Type: boolean
Default: no
When set, mutt will attempt to use the IMAP IDLE extension to check for new mail in the current mailbox. Some servers (dovecot was the inspiration for this option) react badly to mutt's implementation. If your connection seems to freeze up periodically, try unsetting this.

imap_keepalive
Type: number
Default: 900
This variable specifies the maximum amount of time in seconds that mutt will wait before polling open IMAP connections, to prevent the server from closing them before mutt has finished with them. The default is well within the RFC-specified minimum amount of time (30 minutes) before a server is allowed to do this, but in practice the RFC does get violated every now and then. Reduce this number if you find yourself getting disconnected from your IMAP server due to inactivity.

imap_list_subscribed
Type: boolean
Default: no
This variable configures whether IMAP folder browsing will look for only subscribed folders or all folders. This can be toggled in the IMAP browser with the toggle-subscribed function.

imap_login
Type: string
Default: lqrq
Your login name on the IMAP server.
This variable defaults to the value of imap_user.

imap_pass
Type: string
Default: lqrq
Specifies the password for your IMAP account. If unset, Mutt will prompt you for your password when you invoke the fetch-mail function. Warning: you should only use this option when you are on a fairly secure machine, because the superuser can read your muttrc even if you are the only one who can read the file.

imap_passive
Type: boolean
Default: yes
When set, mutt will not open new IMAP connections to check for new mail. Mutt will only check for new mail over existing IMAP connections. This is useful if you don't want to be prompted to user/password pairs on mutt invocation, or if opening the connection is slow.

imap_peek
Type: boolean
Default: yes
When set, mutt will avoid implicitly marking your mail as read whenever you fetch a message from the server. This is generally a good thing, but can make closing an IMAP folder somewhat slower. This option exists to appease speed freaks.

imap_servernoise
Type: boolean
Default: yes
When set, mutt will display warning messages from the IMAP server as error messages. Since these messages are often harmless, or generated due to configuration problems on the server which are out of the users' hands, you may wish to suppress them at some point.

imap_user
Type: string
Default: lqrq
The name of the user whose mail you intend to access on the IMAP server.
This variable defaults to your user name on the local machine.

implicit_autoview
Type: boolean
Default: no
If set to lqyesrq, mutt will look for a mailcap entry with the copiousoutput flag set for every MIME attachment it doesn't have an internal viewer defined for. If such an entry is found, mutt will use the viewer defined in that entry to convert the body part to text form.

include
Type: quadoption
Default: ask-yes
Controls whether or not a copy of the message(s) you are replying to is included in your reply.

include_onlyfirst
Type: boolean
Default: no
Controls whether or not Mutt includes only the first attachment of the message you are replying.

indent_string
Type: string
Default: lq> rq
Specifies the string to prepend to each line of text quoted in a message to which you are replying. You are strongly encouraged not to change this value, as it tends to agitate the more fanatical netizens.
This option is a format string, please see the description of lq$index_formatrq for supported printf()-style sequences.

index_format
Type: string
Default: lq%4C %Z %{%b %d} %-15.15L (%?l?%4l&%4c?) %srq
This variable allows you to customize the message index display to your personal taste.
lqFormat stringsrq are similar to the strings used in the lqCrq function printf to format output (see the man page for more detail). The following sequences are defined in Mutt:
%a
address of the author
%A
reply-to address (if present; otherwise: address of author)
%b
filename of the original message folder (think mailBox)
%B
the list to which the letter was sent, or else the folder name (%b).
%c
number of characters (bytes) in the message
%C
current message number
%d
date and time of the message in the format specified by lqdate_formatrq converted to sender's time zone
%D
date and time of the message in the format specified by lqdate_formatrq converted to the local time zone
%e
current message number in thread
%E
number of messages in current thread
%f
entire From: line (address + real name)
%F
author name, or recipient name if the message is from you
%H
spam attribute(s) of this message
%i
message-id of the current message
%l
number of lines in the message (does not work with maildir, mh, and possibly IMAP folders)
%L
If an address in the To or CC header field matches an address defined by the users lqsubscriberq command, this displays rqTo <list-name>rq, otherwise the same as %F.
%m
total number of message in the mailbox
%M
number of hidden messages if the thread is collapsed.
%N
message score
%n
author's real name (or address if missing)
%O
(_O_riginal save folder) Where mutt would formerly have stashed the message: list name or recipient name if no list
%P
progress indicator for the builtin pager (how much of the file has been displayed)
%s
subject of the message
%S
status of the message (N/D/d/!/r/*)
%t
`to:' field (recipients)
%T
the appropriate character from the $to_chars string
%u
user (login) name of the author
%v
first name of the author, or the recipient if the message is from you
%X
number of attachments (please see the lqattachmentsrq section for possible speed effects)
%y
`x-label:' field, if present
%Y
`x-label' field, if present, and (1) not at part of a thread tree, (2) at the top of a thread, or (3) `x-label' is different from preceding message's `x-label'.
%Z
message status flags
%{fmt}
the date and time of the message is converted to sender's time zone, and lqfmtrq is expanded by the library function lqstrftimerq; a leading bang disables locales
%[fmt]
the date and time of the message is converted to the local time zone, and lqfmtrq is expanded by the library function lqstrftimerq; a leading bang disables locales
%(fmt)
the local date and time when the message was received. lqfmtrq is expanded by the library function lqstrftimerq; a leading bang disables locales
%<fmt>
the current local time. lqfmtrq is expanded by the library function lqstrftimerq; a leading bang disables locales.
%>X
right justify the rest of the string and pad with character rqXrq
%|X
pad to the end of the line with character rqXrq
%*X
soft-fill with character rqXrq as pad
`Soft-fill' deserves some explanation. Normal right-justification will print everything to the left of the %>, displaying padding and the whatever lies to the right only if there's room. By contrast, soft-fill gives priority to the right-hand side, guaranteeing space to display it and showing padding only if there's still room. If necessary, soft-fill will eat text leftwards to make room for rightward text.
See also: lq$to_charsrq.

ispell
Type: path
Default: lqispellrq
How to invoke ispell (GNU's spell-checking software).

keep_flagged
Type: boolean
Default: no
If set, read messages marked as flagged will not be moved from your spool mailbox to your lq$mboxrq mailbox, or as a result of a lqmbox-hookrq command.

locale
Type: string
Default: lqCrq
The locale used by strftime(3) to format dates. Legal values are the strings your system accepts for the locale variable LC_TIME.

mail_check
Type: number
Default: 5
This variable configures how often (in seconds) mutt should look for new mail.

mailcap_path
Type: string
Default: lqrq
This variable specifies which files to consult when attempting to display MIME bodies not directly supported by Mutt.

mailcap_sanitize
Type: boolean
Default: yes
If set, mutt will restrict possible characters in mailcap % expandos to a well-defined set of safe characters. This is the safe setting, but we are not sure it doesn't break some more advanced MIME stuff.
DON'T CHANGE THIS SETTING UNLESS YOU ARE REALLY SURE WHAT YOU ARE DOING!

header_cache
Type: path
Default: lqrq
The header_cache variable points to the header cache database. If header_cache points to a directory it will contain a header cache database per folder. If header_cache points to a file that file will be a single global header cache. By default it is unset so no header caching will be used.

maildir_header_cache_verify
Type: boolean
Default: yes
Check for Maildir unaware programs other than mutt having modified maildir files when the header cache is in use. This incurs one stat(2) per message every time the folder is opened.

header_cache_pagesize
Type: string
Default: lq16384rq
When mutt is compiled with either gdbm or bdb4 as the header cache backend, this option changes the database page size. Too large or too small values can waste space, memory, or CPU time. The default should be more or less optimal for most use cases.

maildir_trash
Type: boolean
Default: no
If set, messages marked as deleted will be saved with the maildir (T)rashed flag instead of unlinked. NOTE: this only applies to maildir-style mailboxes. Setting it will have no effect on other mailbox types.

mark_old
Type: boolean
Default: yes
Controls whether or not mutt marks new unread messages as old if you exit a mailbox without reading them. With this option set, the next time you start mutt, the messages will show up with an rqOrq next to them in the index menu, indicating that they are old.

markers
Type: boolean
Default: yes
Controls the display of wrapped lines in the internal pager. If set, a lq+rq marker is displayed at the beginning of wrapped lines. Also see the lq$smart_wraprq variable.

mask
Type: regular expression
Default: lq!^\.[^.]rq
A regular expression used in the file browser, optionally preceded by the not operator lq!rq. Only files whose names match this mask will be shown. The match is always case-sensitive.

mbox
Type: path
Default: lq~/mboxrq
This specifies the folder into which read mail in your lq$spoolfilerq folder will be appended.

mbox_type
Type: folder magic
Default: mbox
The default mailbox type used when creating new folders. May be any of mbox, MMDF, MH and Maildir.

metoo
Type: boolean
Default: no
If unset, Mutt will remove your address (see the lqalternatesrq command) from the list of recipients when replying to a message.

menu_context
Type: number
Default: 0
This variable controls the number of lines of context that are given when scrolling through menus. (Similar to lq$pager_contextrq.)

menu_move_off
Type: boolean
Default: yes
When unset, the bottom entry of menus will never scroll up past the bottom of the screen, unless there are less entries than lines. When set, the bottom entry may move off the bottom.

menu_scroll
Type: boolean
Default: no
When set, menus will be scrolled up or down one line when you attempt to move across a screen boundary. If unset, the screen is cleared and the next or previous page of the menu is displayed (useful for slow links to avoid many redraws).

meta_key
Type: boolean
Default: no
If set, forces Mutt to interpret keystrokes with the high bit (bit 8) set as if the user had pressed the ESC key and whatever key remains after having the high bit removed. For example, if the key pressed has an ASCII value of 0xf8, then this is treated as if the user had pressed ESC then lqxrq. This is because the result of removing the high bit from lq0xf8rq is lq0x78rq, which is the ASCII character lqxrq.

mh_purge
Type: boolean
Default: no
When unset, mutt will mimic mh's behaviour and rename deleted messages to ,<old file name> in mh folders instead of really deleting them. If the variable is set, the message files will simply be deleted.

mh_seq_flagged
Type: string
Default: lqflaggedrq
The name of the MH sequence used for flagged messages.

mh_seq_replied
Type: string
Default: lqrepliedrq
The name of the MH sequence used to tag replied messages.

mh_seq_unseen
Type: string
Default: lqunseenrq
The name of the MH sequence used for unseen messages.

mime_forward
Type: quadoption
Default: no
When set, the message you are forwarding will be attached as a separate MIME part instead of included in the main body of the message. This is useful for forwarding MIME messages so the receiver can properly view the message as it was delivered to you. If you like to switch between MIME and not MIME from mail to mail, set this variable to ask-no or ask-yes.
Also see lq$forward_decoderq and lq$mime_forward_decoderq.

mime_forward_decode
Type: boolean
Default: no
Controls the decoding of complex MIME messages into text/plain when forwarding a message while lq$mime_forwardrq is set. Otherwise lq$forward_decoderq is used instead.

mime_forward_rest
Type: quadoption
Default: yes
When forwarding multiple attachments of a MIME message from the recvattach menu, attachments which cannot be decoded in a reasonable manner will be attached to the newly composed message if this option is set.

move
Type: quadoption
Default: ask-no
Controls whether or not Mutt will move read messages from your spool mailbox to your lq$mboxrq mailbox, or as a result of a lqmbox-hookrq command.

message_cachedir
Type: path
Default: lqrq
Set this to a directory and mutt will cache copies of messages from your IMAP and POP servers here. You are free to remove entries at any time, for instance if stale entries accumulate because you have deleted messages with another mail client.

message_cache_clean
Type: boolean
Default: no
If set, mutt will clean out obsolete entries from the cache when the mailbox is synchronized. You probably only want to set it every once in a while, since it can be a little slow.

message_format
Type: string
Default: lq%srq
This is the string displayed in the lqattachmentrq menu for attachments of type message/rfc822. For a full listing of defined printf()-like sequences see the section on lq$index_formatrq.

narrow_tree
Type: boolean
Default: no
This variable, when set, makes the thread tree narrower, allowing deeper threads to fit on the screen.

net_inc
Type: number
Default: 10
Operations that expect to transfer a large amount of data over the network will update their progress every net_inc kilobytes. If set to 0, no progress messages will be displayed.
See also lq$read_incrq and lq$write_incrq.

pager
Type: path
Default: lqbuiltinrq
This variable specifies which pager you would like to use to view messages. builtin means to use the builtin pager, otherwise this variable should specify the pathname of the external pager you would like to use.
Using an external pager may have some disadvantages: Additional keystrokes are necessary because you can't call mutt functions directly from the pager, and screen resizes cause lines longer than the screen width to be badly formatted in the help menu.

pager_context
Type: number
Default: 0
This variable controls the number of lines of context that are given when displaying the next or previous page in the internal pager. By default, Mutt will display the line after the last one on the screen at the top of the next page (0 lines of context).

pager_format
Type: string
Default: lq-%Z- %C/%m: %-20.20n   %s%*  -- (%P)rq
This variable controls the format of the one-line message lqstatusrq displayed before each message in either the internal or an external pager. The valid sequences are listed in the lq$index_formatrq section.

pager_index_lines
Type: number
Default: 0
Determines the number of lines of a mini-index which is shown when in the pager. The current message, unless near the top or bottom of the folder, will be roughly one third of the way down this mini-index, giving the reader the context of a few messages before and after the message. This is useful, for example, to determine how many messages remain to be read in the current thread. One of the lines is reserved for the status bar from the index, so a pager_index_lines of 6 will only show 5 lines of the actual index. A value of 0 results in no index being shown. If the number of messages in the current folder is less than pager_index_lines, then the index will only use as many lines as it needs.

pager_stop
Type: boolean
Default: no
When set, the internal-pager will not move to the next message when you are at the end of a message and invoke the next-page function.

crypt_autosign
Type: boolean
Default: no
Setting this variable will cause Mutt to always attempt to cryptographically sign outgoing messages. This can be overridden by use of the pgp-menu, when signing is not required or encryption is requested as well. If lq$smime_is_defaultrq is set, then OpenSSL is used instead to create S/MIME messages and settings can be overridden by use of the smime-menu. (Crypto only)

crypt_autoencrypt
Type: boolean
Default: no
Setting this variable will cause Mutt to always attempt to PGP encrypt outgoing messages. This is probably only useful in connection to the send-hook command. It can be overridden by use of the pgp-menu, when encryption is not required or signing is requested as well. IF lq$smime_is_defaultrq is set, then OpenSSL is used instead to create S/MIME messages and settings can be overridden by use of the smime-menu. (Crypto only)

pgp_ignore_subkeys
Type: boolean
Default: yes
Setting this variable will cause Mutt to ignore OpenPGP subkeys. Instead, the principal key will inherit the subkeys' capabilities. Unset this if you want to play interesting key selection games. (PGP only)

crypt_replyencrypt
Type: boolean
Default: yes
If set, automatically PGP or OpenSSL encrypt replies to messages which are encrypted. (Crypto only)

crypt_replysign
Type: boolean
Default: no
If set, automatically PGP or OpenSSL sign replies to messages which are signed.
Note: this does not work on messages that are encrypted and signed! (Crypto only)

crypt_replysignencrypted
Type: boolean
Default: no
If set, automatically PGP or OpenSSL sign replies to messages which are encrypted. This makes sense in combination with lq$crypt_replyencryptrq, because it allows you to sign all messages which are automatically encrypted. This works around the problem noted in lq$crypt_replysignrq, that mutt is not able to find out whether an encrypted message is also signed. (Crypto only)

crypt_timestamp
Type: boolean
Default: yes
If set, mutt will include a time stamp in the lines surrounding PGP or S/MIME output, so spoofing such lines is more difficult. If you are using colors to mark these lines, and rely on these, you may unset this setting. (Crypto only)

pgp_use_gpg_agent
Type: boolean
Default: no
If set, mutt will use a possibly-running gpg-agent process. (PGP only)

crypt_verify_sig
Type: quadoption
Default: yes
If lqyesrq, always attempt to verify PGP or S/MIME signatures. If lqaskrq, ask whether or not to verify the signature. If lqnorq, never attempt to verify cryptographic signatures. (Crypto only)

smime_is_default
Type: boolean
Default: no
The default behaviour of mutt is to use PGP on all auto-sign/encryption operations. To override and to use OpenSSL instead this must be set. However, this has no effect while replying, since mutt will automatically select the same application that was used to sign/encrypt the original message. (Note that this variable can be overridden by unsetting $crypt_autosmime.) (S/MIME only)

smime_ask_cert_label
Type: boolean
Default: yes
This flag controls whether you want to be asked to enter a label for a certificate about to be added to the database or not. It is set by default. (S/MIME only)

smime_decrypt_use_default_key
Type: boolean
Default: yes
If set (default) this tells mutt to use the default key for decryption. Otherwise, if manage multiple certificate-key-pairs, mutt will try to use the mailbox-address to determine the key to use. It will ask you to supply a key, if it can't find one. (S/MIME only)

pgp_entry_format
Type: string
Default: lq%4n %t%f %4l/0x%k %-4a %2c %urq
This variable allows you to customize the PGP key selection menu to your personal taste. This string is similar to lq$index_formatrq, but has its own set of printf()-like sequences:
%n
number
%k
key id
%u
user id
%a
algorithm
%l
key length
%f
flags
%c
capabilities
%t
trust/validity of the key-uid association
%[<s>]
date of the key where <s> is an strftime(3) expression
(PGP only)

pgp_good_sign
Type: regular expression
Default: lqrq
If you assign a text to this variable, then a PGP signature is only considered verified if the output from $pgp_verify_command contains the text. Use this variable if the exit code from the command is 0 even for bad signatures. (PGP only)

pgp_check_exit
Type: boolean
Default: yes
If set, mutt will check the exit code of the PGP subprocess when signing or encrypting. A non-zero exit code means that the subprocess failed. (PGP only)

pgp_long_ids
Type: boolean
Default: no
If set, use 64 bit PGP key IDs. Unset uses the normal 32 bit Key IDs. (PGP only)

pgp_retainable_sigs
Type: boolean
Default: no
If set, signed and encrypted messages will consist of nested multipart/signed and multipart/encrypted body parts.
This is useful for applications like encrypted and signed mailing lists, where the outer layer (multipart/encrypted) can be easily removed, while the inner multipart/signed part is retained. (PGP only)

pgp_autoinline
Type: boolean
Default: no
This option controls whether Mutt generates old-style inline (traditional) PGP encrypted or signed messages under certain circumstances. This can be overridden by use of the pgp-menu, when inline is not required.
Note that Mutt might automatically use PGP/MIME for messages which consist of more than a single MIME part. Mutt can be configured to ask before sending PGP/MIME messages when inline (traditional) would not work. See also: lq$pgp_mime_autorq.
Also note that using the old-style PGP message format is strongly deprecated. (PGP only)

pgp_replyinline
Type: boolean
Default: no
Setting this variable will cause Mutt to always attempt to create an inline (traditional) message when replying to a message which is PGP encrypted/signed inline. This can be overridden by use of the pgp-menu, when inline is not required. This option does not automatically detect if the (replied-to) message is inline; instead it relies on Mutt internals for previously checked/flagged messages.
Note that Mutt might automatically use PGP/MIME for messages which consist of more than a single MIME part. Mutt can be configured to ask before sending PGP/MIME messages when inline (traditional) would not work. See also: lq$pgp_mime_autorq.
Also note that using the old-style PGP message format is strongly deprecated. (PGP only)

pgp_show_unusable
Type: boolean
Default: yes
If set, mutt will display non-usable keys on the PGP key selection menu. This includes keys which have been revoked, have expired, or have been marked as lqdisabledrq by the user. (PGP only)

pgp_sign_as
Type: string
Default: lqrq
If you have more than one key pair, this option allows you to specify which of your private keys to use. It is recommended that you use the keyid form to specify your key (e.g., lq0x00112233rq). (PGP only)

pgp_strict_enc
Type: boolean
Default: yes
If set, Mutt will automatically encode PGP/MIME signed messages as quoted-printable. Please note that unsetting this variable may lead to problems with non-verifyable PGP signatures, so only change this if you know what you are doing. (PGP only)

pgp_timeout
Type: number
Default: 300
The number of seconds after which a cached passphrase will expire if not used. (PGP only)

pgp_sort_keys
Type: sort order
Default: address
Specifies how the entries in the `pgp keys' menu are sorted. The following are legal values:
address
sort alphabetically by user id
keyid
sort alphabetically by key id
date
sort by key creation date
trust
sort by the trust of the key
If you prefer reverse order of the above values, prefix it with `reverse-'. (PGP only)

pgp_mime_auto
Type: quadoption
Default: ask-yes
This option controls whether Mutt will prompt you for automatically sending a (signed/encrypted) message using PGP/MIME when inline (traditional) fails (for any reason).
Also note that using the old-style PGP message format is strongly deprecated. (PGP only)

pgp_auto_decode
Type: boolean
Default: no
If set, mutt will automatically attempt to decrypt traditional PGP messages whenever the user performs an operation which ordinarily would result in the contents of the message being operated on. For example, if the user displays a pgp-traditional message which has not been manually checked with the check-traditional-pgp function, mutt will automatically check the message for traditional pgp.

pgp_decode_command
Type: string
Default: lqrq
This format strings specifies a command which is used to decode application/pgp attachments.
The PGP command formats have their own set of printf-like sequences:
%p
Expands to PGPPASSFD=0 when a pass phrase is needed, to an empty string otherwise. Note: This may be used with a %? construct.
%f
Expands to the name of a file containing a message.
%s
Expands to the name of a file containing the signature part
           of a multipart/signed attachment when verifying it.
%a
The value of $pgp_sign_as.
%r
One or more key IDs.
For examples on how to configure these formats for the various versions of PGP which are floating around, see the pgp*.rc and gpg.rc files in the samples/ subdirectory which has been installed on your system alongside the documentation. (PGP only)

pgp_getkeys_command
Type: string
Default: lqrq
This command is invoked whenever mutt will need public key information. %r is the only printf-like sequence used with this format. (PGP only)

pgp_verify_command
Type: string
Default: lqrq
This command is used to verify PGP signatures. (PGP only)

pgp_decrypt_command
Type: string
Default: lqrq
This command is used to decrypt a PGP encrypted message. (PGP only)

pgp_clearsign_command
Type: string
Default: lqrq
This format is used to create a old-style rqclearsignedrq PGP message. Note that the use of this format is strongly deprecated. (PGP only)

pgp_sign_command
Type: string
Default: lqrq
This command is used to create the detached PGP signature for a multipart/signed PGP/MIME body part. (PGP only)

pgp_encrypt_sign_command
Type: string
Default: lqrq
This command is used to both sign and encrypt a body part. (PGP only)

pgp_encrypt_only_command
Type: string
Default: lqrq
This command is used to encrypt a body part without signing it. (PGP only)

pgp_import_command
Type: string
Default: lqrq
This command is used to import a key from a message into the user's public key ring. (PGP only)

pgp_export_command
Type: string
Default: lqrq
This command is used to export a public key from the user's key ring. (PGP only)

pgp_verify_key_command
Type: string
Default: lqrq
This command is used to verify key information from the key selection menu. (PGP only)

pgp_list_secring_command
Type: string
Default: lqrq
This command is used to list the secret key ring's contents. The output format must be analogous to the one used by gpg --list-keys --with-colons.
This format is also generated by the pgpring utility which comes with mutt. (PGP only)

pgp_list_pubring_command
Type: string
Default: lqrq
This command is used to list the public key ring's contents. The output format must be analogous to the one used by gpg --list-keys --with-colons.
This format is also generated by the pgpring utility which comes with mutt. (PGP only)

forward_decrypt
Type: boolean
Default: yes
Controls the handling of encrypted messages when forwarding a message. When set, the outer layer of encryption is stripped off. This variable is only used if lq$mime_forwardrq is set and lq$mime_forward_decoderq is unset. (PGP only)

smime_timeout
Type: number
Default: 300
The number of seconds after which a cached passphrase will expire if not used. (S/MIME only)

smime_encrypt_with
Type: string
Default: lqrq
This sets the algorithm that should be used for encryption. Valid choices are rqdesrq, rqdes3rq, rqrc2-40rq, rqrc2-64rq, rqrc2-128rq. If unset rq3desrq (TripleDES) is used. (S/MIME only)

smime_keys
Type: path
Default: lqrq
Since there is no pubring/secring as with PGP, mutt has to handle storage ad retrieval of keys/certs by itself. This is very basic right now, and stores keys and certificates in two different directories, both named as the hash-value retrieved from OpenSSL. There is an index file which contains mailbox-address keyid pair, and which can be manually edited. This one points to the location of the private keys. (S/MIME only)

smime_ca_location
Type: path
Default: lqrq
This variable contains the name of either a directory, or a file which contains trusted certificates for use with OpenSSL. (S/MIME only)

smime_certificates
Type: path
Default: lqrq
Since there is no pubring/secring as with PGP, mutt has to handle storage and retrieval of keys by itself. This is very basic right now, and keys and certificates are stored in two different directories, both named as the hash-value retrieved from OpenSSL. There is an index file which contains mailbox-address keyid pairs, and which can be manually edited. This one points to the location of the certificates. (S/MIME only)

smime_decrypt_command
Type: string
Default: lqrq
This format string specifies a command which is used to decrypt application/x-pkcs7-mime attachments.
The OpenSSL command formats have their own set of printf-like sequences similar to PGP's:
%f
Expands to the name of a file containing a message.
%s
Expands to the name of a file containing the signature part
           of a multipart/signed attachment when verifying it.
%k
The key-pair specified with $smime_default_key
%c
One or more certificate IDs.
%a
The algorithm used for encryption.
%C
CA location: Depending on whether $smime_ca_location
           points to a directory or file, this expands to 
           rq-CApath $smime_ca_locationrq or rq-CAfile $smime_ca_locationrq.
For examples on how to configure these formats, see the smime.rc in the samples/ subdirectory which has been installed on your system alongside the documentation. (S/MIME only)

smime_verify_command
Type: string
Default: lqrq
This command is used to verify S/MIME signatures of type multipart/signed. (S/MIME only)

smime_verify_opaque_command
Type: string
Default: lqrq
This command is used to verify S/MIME signatures of type application/x-pkcs7-mime. (S/MIME only)

smime_sign_command
Type: string
Default: lqrq
This command is used to created S/MIME signatures of type multipart/signed, which can be read by all mail clients. (S/MIME only)

smime_sign_opaque_command
Type: string
Default: lqrq
This command is used to created S/MIME signatures of type application/x-pkcs7-signature, which can only be handled by mail clients supporting the S/MIME extension. (S/MIME only)

smime_encrypt_command
Type: string
Default: lqrq
This command is used to create encrypted S/MIME messages. (S/MIME only)

smime_pk7out_command
Type: string
Default: lqrq
This command is used to extract PKCS7 structures of S/MIME signatures, in order to extract the public X509 certificate(s). (S/MIME only)

smime_get_cert_command
Type: string
Default: lqrq
This command is used to extract X509 certificates from a PKCS7 structure. (S/MIME only)

smime_get_signer_cert_command
Type: string
Default: lqrq
This command is used to extract only the signers X509 certificate from a S/MIME signature, so that the certificate's owner may get compared to the email's 'From'-field. (S/MIME only)

smime_import_cert_command
Type: string
Default: lqrq
This command is used to import a certificate via smime_keys. (S/MIME only)

smime_get_cert_email_command
Type: string

Default: lqrq
This command is used to extract the mail address(es) used for storing X509 certificates, and for verification purposes (to check whether the certificate was issued for the sender's mailbox). (S/MIME only)

smime_default_key
Type: string
Default: lqrq
This is the default key-pair to use for signing. This must be set to the keyid (the hash-value that OpenSSL generates) to work properly (S/MIME only)

ssl_force_tls
Type: boolean
Default: no
If this variable is set, Mutt will require that all connections to remote servers be encrypted. Furthermore it will attempt to negotiate TLS even if the server does not advertise the capability, since it would otherwise have to abort the connection anyway. This option supersedes lq$ssl_starttlsrq.

ssl_starttls
Type: quadoption
Default: yes
If set (the default), mutt will attempt to use STARTTLS on servers advertising the capability. When unset, mutt will not attempt to use STARTTLS regardless of the server's capabilities.

certificate_file
Type: path
Default: lq~/.mutt_certificatesrq
This variable specifies the file where the certificates you trust are saved. When an unknown certificate is encountered, you are asked if you accept it or not. If you accept it, the certificate can also be saved in this file and further connections are automatically accepted.
You can also manually add CA certificates in this file. Any server certificate that is signed with one of these CA certificates are also automatically accepted.
Example: set certificate_file=~/.mutt/certificates

ssl_use_sslv3
Type: boolean
Default: yes
This variables specifies whether to attempt to use SSLv3 in the SSL authentication process.

ssl_use_tlsv1
Type: boolean
Default: yes
This variables specifies whether to attempt to use TLSv1 in the SSL authentication process.

ssl_min_dh_prime_bits
Type: number
Default: 0
This variable specifies the minimum acceptable prime size (in bits) for use in any Diffie-Hellman key exchange. A value of 0 will use the default from the GNUTLS library.

ssl_ca_certificates_file
Type: path
Default: lqrq
This variable specifies a file containing trusted CA certificates. Any server certificate that is signed with one of these CA certificates are also automatically accepted.
Example: set ssl_ca_certificates_file=/etc/ssl/certs/ca-certificates.crt

pipe_split
Type: boolean
Default: no
Used in connection with the pipe-message command and the lqtag- prefixrq operator. If this variable is unset, when piping a list of tagged messages Mutt will concatenate the messages and will pipe them as a single folder. When set, Mutt will pipe the messages one by one. In both cases the messages are piped in the current sorted order, and the lq$pipe_seprq separator is added after each message.

pipe_decode
Type: boolean
Default: no
Used in connection with the pipe-message command. When unset, Mutt will pipe the messages without any preprocessing. When set, Mutt will weed headers and will attempt to PGP/MIME decode the messages first.

pipe_sep
Type: string
Default: lq\nrq
The separator to add between messages when piping a list of tagged messages to an external Unix command.

pop_authenticators
Type: string
Default: lqrq
This is a colon-delimited list of authentication methods mutt may attempt to use to log in to an POP server, in the order mutt should try them. Authentication methods are either 'user', 'apop' or any SASL mechanism, eg 'digest-md5', 'gssapi' or 'cram-md5'. This parameter is case-insensitive. If this parameter is unset (the default) mutt will try all available methods, in order from most-secure to least-secure.
Example: set pop_authenticators=rqdigest-md5:apop:userrq

pop_auth_try_all
Type: boolean
Default: yes
If set, Mutt will try all available methods. When unset, Mutt will only fall back to other authentication methods if the previous methods are unavailable. If a method is available but authentication fails, Mutt will not connect to the POP server.

pop_checkinterval
Type: number
Default: 60
This variable configures how often (in seconds) mutt should look for new mail in the currently selected mailbox if it is a POP mailbox.

pop_delete
Type: quadoption
Default: ask-no
If set, Mutt will delete successfully downloaded messages from the POP server when using the fetch-mail function. When unset, Mutt will download messages but also leave them on the POP server.

pop_host
Type: string
Default: lqrq
The name of your POP server for the fetch-mail function. You can also specify an alternative port, username and password, ie:
[pop[s]://][username[:password]@]popserver[:port]

pop_last
Type: boolean
Default: no
If this variable is set, mutt will try to use the rqLASTrq POP command for retrieving only unread messages from the POP server when using the fetch-mail function.

pop_reconnect
Type: quadoption
Default: ask-yes
Controls whether or not Mutt will try to reconnect to POP server if the connection is lost.

pop_user
Type: string
Default: lqrq
Your login name on the POP server.
This variable defaults to your user name on the local machine.

pop_pass
Type: string
Default: lqrq
Specifies the password for your POP account. If unset, Mutt will prompt you for your password when you open POP mailbox. Warning: you should only use this option when you are on a fairly secure machine, because the superuser can read your muttrc even if you are the only one who can read the file.

post_indent_string
Type: string
Default: lqrq
Similar to the lq$attributionrq variable, Mutt will append this string after the inclusion of a message which is being replied to.

postpone
Type: quadoption
Default: ask-yes
Controls whether or not messages are saved in the lq$postponedrq mailbox when you elect not to send immediately.

postponed
Type: path
Default: lq~/postponedrq
Mutt allows you to indefinitely lqpostpone sending a messagerq which you are editing. When you choose to postpone a message, Mutt saves it in the mailbox specified by this variable. Also see the lq$postponerq variable.

preconnect
Type: string
Default: lqrq
If set, a shell command to be executed if mutt fails to establish a connection to the server. This is useful for setting up secure connections, e.g. with ssh(1). If the command returns a nonzero status, mutt gives up opening the server. Example:
preconnect=rqssh -f -q -L 1234:mailhost.net:143 mailhost.net sleep 20 < /dev/null > /dev/nullrq
Mailbox 'foo' on mailhost.net can now be reached as '{localhost:1234}foo'.
NOTE: For this example to work, you must be able to log in to the remote machine without having to enter a password.

print
Type: quadoption
Default: ask-no
Controls whether or not Mutt really prints messages. This is set to ask-no by default, because some people accidentally hit lqprq often (like me).

print_command
Type: path
Default: lqlprrq
This specifies the command pipe that should be used to print messages.

print_decode
Type: boolean
Default: yes
Used in connection with the print-message command. If this option is set, the message is decoded before it is passed to the external command specified by $print_command. If this option is unset, no processing will be applied to the message when printing it. The latter setting may be useful if you are using some advanced printer filter which is able to properly format e-mail messages for printing.

print_split
Type: boolean
Default: no
Used in connection with the print-message command. If this option is set, the command specified by $print_command is executed once for each message which is to be printed. If this option is unset, the command specified by $print_command is executed only once, and all the messages are concatenated, with a form feed as the message separator.
Those who use the enscript(1) program's mail-printing mode will most likely want to set this option.

prompt_after
Type: boolean
Default: yes
If you use an external lq$pagerrq, setting this variable will cause Mutt to prompt you for a command when the pager exits rather than returning to the index menu. If unset, Mutt will return to the index menu when the external pager exits.

query_command
Type: path
Default: lqrq
This specifies the command that mutt will use to make external address queries. The string should contain a %s, which will be substituted with the query string the user types. See lqqueryrq for more information.

quit
Type: quadoption
Default: yes
This variable controls whether lqquitrq and lqexitrq actually quit from mutt. If it set to yes, they do quit, if it is set to no, they have no effect, and if it is set to ask-yes or ask-no, you are prompted for confirmation when you try to quit.

quote_regexp
Type: regular expression
Default: lq^([ \t]*[|>:}#])+rq
A regular expression used in the internal-pager to determine quoted sections of text in the body of a message.
Note: In order to use the quotedx patterns in the internal pager, you need to set this to a regular expression that matches exactly the quote characters at the beginning of quoted lines.

read_inc
Type: number
Default: 10
If set to a value greater than 0, Mutt will display which message it is currently on when reading a mailbox or when performing search actions such as search and limit. The message is printed after read_inc messages have been read or searched (e.g., if set to 25, Mutt will print a message when it is at message 25, and then again when it gets to message 50). This variable is meant to indicate progress when reading or searching large mailboxes which may take some time. When set to 0, only a single message will appear before the reading the mailbox.
Also see the lq$write_incrq variable and the lqTuningrq section of the manual for performance considerations.

read_only
Type: boolean
Default: no
If set, all folders are opened in read-only mode.

realname
Type: string
Default: lqrq
This variable specifies what rqrealrq or rqpersonalrq name should be used when sending messages.
By default, this is the GECOS field from /etc/passwd. Note that this variable will not be used when the user has set a real name in the $from variable.

recall
Type: quadoption
Default: ask-yes
Controls whether or not Mutt recalls postponed messages when composing a new message. Also see lq$postponedrq.
Setting this variable to lqyesrq is not generally useful, and thus not recommended.

record
Type: path
Default: lq~/sentrq
This specifies the file into which your outgoing messages should be appended. (This is meant as the primary method for saving a copy of your messages, but another way to do this is using the lqmy_hdrrq command to create a Bcc: field with your email address in it.)
The value of $record is overridden by the lq$force_namerq and lq$save_namerq variables, and the lqfcc-hookrq command.

reply_regexp
Type: regular expression
Default: lq^(re([\[0-9\]+])*|aw):[ \t]*rq
A regular expression used to recognize reply messages when threading and replying. The default value corresponds to the English rqRe:rq and the German rqAw:rq.

reply_self
Type: boolean
Default: no
If unset and you are replying to a message sent by you, Mutt will assume that you want to reply to the recipients of that message rather than to yourself.

reply_to
Type: quadoption
Default: ask-yes
If set, when replying to a message, Mutt will use the address listed in the Reply-to: header as the recipient of the reply. If unset, it will use the address in the From: header field instead. This option is useful for reading a mailing list that sets the Reply-To: header field to the list address and you want to send a private message to the author of a message.

resolve
Type: boolean
Default: yes
When set, the cursor will be automatically advanced to the next (possibly undeleted) message whenever a command that modifies the current message is executed.

reverse_alias
Type: boolean
Default: no
This variable controls whether or not Mutt will display the rqpersonalrq name from your aliases in the index menu if it finds an alias that matches the message's sender. For example, if you have the following alias:

alias juser abd30425@somewhere.net (Joe User)

and then you receive mail which contains the following header:

From: abd30425@somewhere.net

It would be displayed in the index menu as lqJoe Userrq instead of lqabd30425@somewhere.net.rq This is useful when the person's e-mail address is not human friendly (like CompuServe addresses).

reverse_name
Type: boolean
Default: no
It may sometimes arrive that you receive mail to a certain machine, move the messages to another machine, and reply to some the messages from there. If this variable is set, the default From: line of the reply messages is built using the address where you received the messages you are replying to if that address matches your alternates. If the variable is unset, or the address that would be used doesn't match your alternates, the From: line will use your address on the current machine.

reverse_realname
Type: boolean
Default: yes
This variable fine-tunes the behaviour of the reverse_name feature. When it is set, mutt will use the address from incoming messages as-is, possibly including eventual real names. When it is unset, mutt will override any such real names with the setting of the realname variable.

rfc2047_parameters
Type: boolean
Default: no
When this variable is set, Mutt will decode RFC-2047-encoded MIME parameters. You want to set this variable when mutt suggests you to save attachments to files named like this: =?iso-8859-1?Q?file=5F=E4=5F991116=2Ezip?=
When this variable is set interactively, the change doesn't have the desired effect before you have changed folders.
Note that this use of RFC 2047's encoding is explicitly, prohibited by the standard, but nevertheless encountered in the wild. Also note that setting this parameter will not have the effect that mutt generates this kind of encoding. Instead, mutt will unconditionally use the encoding specified in RFC 2231.

save_address
Type: boolean
Default: no
If set, mutt will take the sender's full address when choosing a default folder for saving a mail. If lq$save_namerq or lq$force_namerq is set too, the selection of the fcc folder will be changed as well.

save_empty
Type: boolean
Default: yes
When unset, mailboxes which contain no saved messages will be removed when closed (the exception is lq$spoolfilerq which is never removed). If set, mailboxes are never removed.
Note: This only applies to mbox and MMDF folders, Mutt does not delete MH and Maildir directories.

save_history
Type: number
Default: 0
This variable controls the size of the history saved in the lq$history_filerq file.

save_name
Type: boolean
Default: no
This variable controls how copies of outgoing messages are saved. When set, a check is made to see if a mailbox specified by the recipient address exists (this is done by searching for a mailbox in the lq$folderrq directory with the username part of the recipient address). If the mailbox exists, the outgoing message will be saved to that mailbox, otherwise the message is saved to the lq$recordrq mailbox.
Also see the lq$force_namerq variable.

score
Type: boolean
Default: yes
When this variable is unset, scoring is turned off. This can be useful to selectively disable scoring for certain folders when the lq$score_threshold_deleterq variable and friends are used.

score_threshold_delete
Type: number
Default: -1
Messages which have been assigned a score equal to or lower than the value of this variable are automatically marked for deletion by mutt. Since mutt scores are always greater than or equal to zero, the default setting of this variable will never mark a message for deletion.

score_threshold_flag
Type: number
Default: 9999
Messages which have been assigned a score greater than or equal to this variable's value are automatically marked rqflaggedrq.

score_threshold_read
Type: number
Default: -1
Messages which have been assigned a score equal to or lower than the value of this variable are automatically marked as read by mutt. Since mutt scores are always greater than or equal to zero, the default setting of this variable will never mark a message read.

send_charset
Type: string
Default: lqus-ascii:iso-8859-1:utf-8rq
A colon-delimited list of character sets for outgoing messages. Mutt will use the first character set into which the text can be converted exactly. If your lq$charsetrq is not iso-8859-1 and recipients may not understand UTF-8, it is advisable to include in the list an appropriate widely used standard character set (such as iso-8859-2, koi8-r or iso-2022-jp) either instead of or after rqiso-8859-1rq.
In case the text cannot be converted into one of these exactly, mutt uses lq$charsetrq as a fallback.

sendmail
Type: path
Default: lq/usr/sbin/sendmail -oem -oirq
Specifies the program and arguments used to deliver mail sent by Mutt. Mutt expects that the specified program interprets additional arguments as recipient addresses.

sendmail_wait
Type: number
Default: 0
Specifies the number of seconds to wait for the lq$sendmailrq process to finish before giving up and putting delivery in the background.
Mutt interprets the value of this variable as follows:
>0
number of seconds to wait for sendmail to finish before continuing
0
wait forever for sendmail to finish
<0
always put sendmail in the background without waiting
Note that if you specify a value other than 0, the output of the child process will be put in a temporary file. If there is some error, you will be informed as to where to find the output.

shell
Type: path
Default: lqrq
Command to use when spawning a subshell. By default, the user's login shell from /etc/passwd is used.

sig_dashes
Type: boolean
Default: yes
If set, a line containing lq-- rq will be inserted before your lq$signaturerq. It is strongly recommended that you not unset this variable unless your lqsignaturerq contains just your name. The reason for this is because many software packages use lq-- \nrq to detect your signature. For example, Mutt has the ability to highlight the signature in a different color in the builtin pager.

sig_on_top
Type: boolean
Default: no
If set, the signature will be included before any quoted or forwarded text. It is strongly recommended that you do not set this variable unless you really know what you are doing, and are prepared to take some heat from netiquette guardians.

signature
Type: path
Default: lq~/.signaturerq
Specifies the filename of your signature, which is appended to all outgoing messages. If the filename ends with a pipe (lq|rq), it is assumed that filename is a shell command and input should be read from its stdout.

simple_search
Type: string
Default: lq~f %s | ~s %srq
Specifies how Mutt should expand a simple search into a real search pattern. A simple search is one that does not contain any of the ~ operators. See lqpatternsrq for more information on search patterns.
For example, if you simply type joe at a search or limit prompt, Mutt will automatically expand it to the value specified by this variable. For the default value it would be:
~f joe | ~s joe

smart_wrap
Type: boolean
Default: yes
Controls the display of lines longer than the screen width in the internal pager. If set, long lines are wrapped at a word boundary. If unset, lines are simply wrapped at the screen edge. Also see the lq$markersrq variable.

smileys
Type: regular expression
Default: lq(>From )|(:[-^]?[][)(><}{|/DP])rq
The pager uses this variable to catch some common false positives of lq$quote_regexprq, most notably smileys in the beginning of a line

sleep_time
Type: number
Default: 1
Specifies time, in seconds, to pause while displaying certain informational messages, while moving from folder to folder and after expunging messages from the current folder. The default is to pause one second, so a value of zero for this option suppresses the pause.

smtp_authenticators
Type: string
Default: lqrq
This is a colon-delimited list of authentication methods mutt may attempt to use to log in to an SMTP server, in the order mutt should try them. Authentication methods are any SASL mechanism, eg lqdigest-md5rq, lqgssapirq or lqcram-md5rq. This parameter is case-insensitive. If this parameter is unset (the default) mutt will try all available methods, in order from most-secure to least-secure.
Example: set smtp_authenticators=rqdigest-md5:cram-md5rq

smtp_pass
Type: string
Default: lqrq
Specifies the password for your SMTP account. If unset, Mutt will prompt you for your password when you first send mail via SMTP. See lqsmtp_urlrq to configure mutt to send mail via SMTP. Warning: you should only use this option when you are on a fairly secure machine, because the superuser can read your muttrc even if you are the only one who can read the file.

smtp_url
Type: string
Default: lqrq
Defines the SMTP lqsmartrq host where sent messages should relayed for delivery. This should take the form of an SMTP URL, eg:
smtp[s]://[user[:pass]@]host[:port]/
Setting this variable overrides the value of the lq$sendmailrq variable.

sort
Type: sort order
Default: date
Specifies how to sort messages in the index menu. Valid values are:

   date or date-sent
   date-received
   from
   mailbox-order (unsorted)
   score
   size
   spam
   subject
   threads
   to

You may optionally use the reverse- prefix to specify reverse sorting order (example: set sort=reverse-date-sent).

sort_alias
Type: sort order
Default: alias
Specifies how the entries in the `alias' menu are sorted. The following are legal values:

   address (sort alphabetically by email address)
   alias (sort alphabetically by alias name)
   unsorted (leave in order specified in .muttrc)

sort_aux
Type: sort order
Default: date
When sorting by threads, this variable controls how threads are sorted in relation to other threads, and how the branches of the thread trees are sorted. This can be set to any value that lq$sortrq can, except threads (in that case, mutt will just use date-sent). You can also specify the last- prefix in addition to the reverse- prefix, but last- must come after reverse-. The last- prefix causes messages to be sorted against its siblings by which has the last descendant, using the rest of sort_aux as an ordering. For instance, set sort_aux=last- date-received would mean that if a new message is received in a thread, that thread becomes the last one displayed (or the first, if you have set sort=reverse-threads.) Note: For reversed lq$sortrq order $sort_aux is reversed again (which is not the right thing to do, but kept to not break any existing configuration setting).

sort_browser
Type: sort order
Default: alpha
Specifies how to sort entries in the file browser. By default, the entries are sorted alphabetically. Valid values:

   alpha (alphabetically)
   date
   size
   unsorted

You may optionally use the reverse- prefix to specify reverse sorting order (example: set sort_browser=reverse-date).

sort_re
Type: boolean
Default: yes
This variable is only useful when sorting by threads with lq$strict_threadsrq unset. In that case, it changes the heuristic mutt uses to thread messages by subject. With sort_re set, mutt will only attach a message as the child of another message by subject if the subject of the child message starts with a substring matching the setting of lq$reply_regexprq. With sort_re unset, mutt will attach the message whether or not this is the case, as long as the non-lq$reply_regexprq parts of both messages are identical.

spam_separator
Type: string
Default: lq,rq
lqspam_separatorrq controls what happens when multiple spam headers are matched: if unset, each successive header will overwrite any previous matches value for the spam label. If set, each successive match will append to the previous, using lqspam_separatorrq as a separator.

spoolfile
Type: path
Default: lqrq
If your spool mailbox is in a non-default place where Mutt cannot find it, you can specify its location with this variable. Mutt will automatically set this variable to the value of the environment variable $MAIL if it is not set.

status_chars
Type: string
Default: lq-*%Arq
Controls the characters used by the rq%rrq indicator in lq$status_formatrq. The first character is used when the mailbox is unchanged. The second is used when the mailbox has been changed, and it needs to be resynchronized. The third is used if the mailbox is in read-only mode, or if the mailbox will not be written when exiting that mailbox (You can toggle whether to write changes to a mailbox with the toggle-write operation, bound by default to rq%rq). The fourth is used to indicate that the current folder has been opened in attach- message mode (Certain operations like composing a new mail, replying, forwarding, etc. are not permitted in this mode).

status_format
Type: string
Default: lq-%r-Mutt: %f [Msgs:%?M?%M/?%m%?n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]---(%s/%S)-%>-(%P)---rq
Controls the format of the status line displayed in the index menu. This string is similar to lq$index_formatrq, but has its own set of printf()-like sequences:
%b
number of mailboxes with new mail *
%d
number of deleted messages *
%f
the full pathname of the current mailbox
%F
number of flagged messages *
%h
local hostname
%l
size (in bytes) of the current mailbox *
%L
size (in bytes) of the messages shown (i.e., which match the current limit) *
%m
the number of messages in the mailbox *
%M
the number of messages shown (i.e., which match the current limit) *
%n
number of new messages in the mailbox *
%o
number of old unread messages *
%p
number of postponed messages *
%P
percentage of the way through the index
%r
modified/read-only/won't-write/attach-message indicator, according to $status_chars
%s
current sorting mode ($sort)
%S
current aux sorting method ($sort_aux)
%t
number of tagged messages *
%u
number of unread messages *
%v
Mutt version string
%V
currently active limit pattern, if any *
%>X
right justify the rest of the string and pad with rqXrq
%|X
pad to the end of the line with rqXrq
%*X
soft-fill with character rqXrq as pad
For an explanation of `soft-fill', see the lq$index_formatrq documentation.
* = can be optionally printed if nonzero
Some of the above sequences can be used to optionally print a string if their value is nonzero. For example, you may only want to see the number of flagged messages if such messages exist, since zero is not particularly meaningful. To optionally print a string based upon one of the above sequences, the following construct is used:
%?<sequence_char>?<optional_string>?
where sequence_char is a character from the table above, and optional_string is the string you would like printed if sequence_char is nonzero. optional_string may contain other sequences as well as normal text, but you may not nest optional strings.
Here is an example illustrating how to optionally print the number of new messages in a mailbox: %?n?%n new messages.?
You can also switch between two strings using the following construct:
%?<sequence_char>?<if_string>&<else_string>?
If the value of sequence_char is non-zero, if_string will be expanded, otherwise else_string will be expanded.
You can force the result of any printf-like sequence to be lowercase by prefixing the sequence character with an underscore (_) sign. For example, if you want to display the local hostname in lowercase, you would use: %_h
If you prefix the sequence character with a colon (:) character, mutt will replace any dots in the expansion by underscores. This might be helpful with IMAP folders that don't like dots in folder names.

status_on_top
Type: boolean
Default: no
Setting this variable causes the lqstatus barrq to be displayed on the first line of the screen rather than near the bottom.

strict_threads
Type: boolean
Default: no
If set, threading will only make use of the lqIn-Reply-Torq and lqReferencesrq fields when you lq$sortrq by message threads. By default, messages with the same subject are grouped together in lqpseudo threads.rq. This may not always be desirable, such as in a personal mailbox where you might have several unrelated messages with the subject lqhirq which will get grouped together. See also lq$sort_rerq for a less drastic way of controlling this behaviour.

suspend
Type: boolean
Default: yes
When unset, mutt won't stop when the user presses the terminal's susp key, usually lqcontrol-Zrq. This is useful if you run mutt inside an xterm using a command like xterm -e mutt.

text_flowed
Type: boolean
Default: no
When set, mutt will generate text/plain; format=flowed attachments. This format is easier to handle for some mailing software, and generally just looks like ordinary text. To actually make use of this format's features, you'll need support in your editor.
Note that $indent_string is ignored when this option is set.

thread_received
Type: boolean
Default: no
When set, mutt uses the date received rather than the date sent to thread messages by subject.

thorough_search
Type: boolean
Default: no
Affects the ~b and ~h search operations described in section lqpatternsrq above. If set, the headers and attachments of messages to be searched are decoded before searching. If unset, messages are searched as they appear in the folder.

tilde
Type: boolean
Default: no
When set, the internal-pager will pad blank lines to the bottom of the screen with a tilde (~).

timeout
Type: number
Default: 600
This variable controls the number of seconds Mutt will wait for a key to be pressed in the main menu before timing out and checking for new mail. A value of zero or less will cause Mutt to never time out.

tmpdir
Type: path
Default: lqrq
This variable allows you to specify where Mutt will place its temporary files needed for displaying and composing messages. If this variable is not set, the environment variable TMPDIR is used. If TMPDIR is not set then rq/tmprq is used.

to_chars
Type: string
Default: lq +TCFLrq
Controls the character used to indicate mail addressed to you. The first character is the one used when the mail is NOT addressed to your address (default: space). The second is used when you are the only recipient of the message (default: +). The third is when your address appears in the TO header field, but you are not the only recipient of the message (default: T). The fourth character is used when your address is specified in the CC header field, but you are not the only recipient. The fifth character is used to indicate mail that was sent by you. The sixth character is used to indicate when a mail was sent to a mailing-list you subscribe to (default: L).

tunnel
Type: string
Default: lqrq
Setting this variable will cause mutt to open a pipe to a command instead of a raw socket. You may be able to use this to set up preauthenticated connections to your IMAP/POP3 server. Example:
tunnel=rqssh -q mailhost.net /usr/local/libexec/imapdrq
NOTE: For this example to work you must be able to log in to the remote machine without having to enter a password.

use_8bitmime
Type: boolean
Default: no
Warning: do not set this variable unless you are using a version of sendmail which supports the -B8BITMIME flag (such as sendmail 8.8.x) or you may not be able to send mail.
When set, Mutt will invoke lq$sendmailrq with the -B8BITMIME flag when sending 8-bit messages to enable ESMTP negotiation.

use_domain
Type: boolean
Default: yes
When set, Mutt will qualify all local addresses (ones without the @host portion) with the value of lq$hostnamerq. If unset, no addresses will be qualified.

use_envelope_from
Type: boolean
Default: no
When set, mutt will set the envelope sender of the message. If lq$envelope_from_addressrq is set, it will be used as the sender address. If not, mutt will attempt to derive the sender from the rqFrom:rq header.
Note that this information is passed to sendmail command using the rq-frq command line switch. Therefore setting this option is not useful if the lq$sendmailrq variable already contains rq-frq or if the executable pointed to by $sendmail doesn't support the rq-frq switch.

use_from
Type: boolean
Default: yes
When set, Mutt will generate the `From:' header field when sending messages. If unset, no `From:' header field will be generated unless the user explicitly sets one using the lqmy_hdrrq command.

use_idn
Type: boolean
Default: yes
When set, Mutt will show you international domain names decoded. Note: You can use IDNs for addresses even if this is unset. This variable only affects decoding.

use_ipv6
Type: boolean
Default: yes
When set, Mutt will look for IPv6 addresses of hosts it tries to contact. If this option is unset, Mutt will restrict itself to IPv4 addresses. Normally, the default should work.

user_agent
Type: boolean
Default: yes
When set, mutt will add a rqUser-Agentrq header to outgoing messages, indicating which version of mutt was used for composing them.

visual
Type: path
Default: lqrq
Specifies the visual editor to invoke when the ~v command is given in the builtin editor.

wait_key
Type: boolean
Default: yes
Controls whether Mutt will ask you to press a key after shell- escape, pipe-message, pipe-entry, print-message, and print-entry commands.
It is also used when viewing attachments with lqauto_viewrq, provided that the corresponding mailcap entry has a needsterminal flag, and the external program is interactive.
When set, Mutt will always ask for a key. When unset, Mutt will wait for a key only if the external command returned a non-zero status.

weed
Type: boolean
Default: yes
When set, mutt will weed headers when displaying, forwarding, printing, or replying to messages.

wrap
Type: number
Default: 0
When set to a positive value, mutt will wrap text at $wrap characters. When set to a negative value, mutt will wrap text so that there are $wrap characters of empty space on the right side of the terminal.

wrap_search
Type: boolean
Default: yes
Controls whether searches wrap around the end of the mailbox.
When set, searches will wrap around the first (or last) message. When unset, searches will not wrap.

wrapmargin
Type: number
Default: 0
(DEPRECATED) Equivalent to setting wrap with a negative value.

write_inc
Type: number
Default: 10
When writing a mailbox, a message will be printed every write_inc messages to indicate progress. If set to 0, only a single message will be displayed before writing a mailbox.
Also see the lq$read_incrq variable.

write_bcc
Type: boolean
Default: yes
Controls whether mutt writes out the Bcc header when preparing messages to be sent. Exim users may wish to unset this. If mutt is set to deliver directly via SMTP (see lq$smtp_urlrq), this option does nothing: mutt will never write out the BCC header in this case.

 

SEE ALSO

iconv(1), iconv(3), mailcap(5), maildir(5), mbox(5), mutt(1), printf(3), regex(7), strftime(3)

The Mutt Manual

The Mutt home page: http://www.mutt.org/  

AUTHOR

Michael Elkins, and others. Use <mutt-dev@mutt.org> to contact the developers.


 

Index

NAME
DESCRIPTION
COMMANDS
PATTERNS
Constructing Patterns
Simple Patterns
Matching dates
CONFIGURATION VARIABLES
SEE ALSO
AUTHOR

Syndicate content