run-mailcap (1) - Linux Manuals

run-mailcap: execute programs via entries in the


run-mailcap, view, see, edit, compose, print - execute programs via entries in the mailcap file


run-mailcap --action=ACTION [--option[=value]] [MIME-TYPE:[ENCODING:]]FILE [...]

The see, edit, compose and print versions are just aliases that default to the view, edit, compose, and print actions (respectively).


run-mailcap (or any of its aliases) will use the given action to process each mime-type/file in turn. Each file is specified as its mime-type, its encoding (e.g. compression), and filename together, separated by colons. If the mime-type is omitted, an attempt to determine the type is made by trying to match the file's extension with those in the mime.types files. If no mime-type is found, a last attempt will be done by running the file command, if available. If the encoding is omitted, it will also be determined from the file's extensions. Currently supported encodings are gzip (.gz), bzip2 (.bz2), xz (.xz), and compress (.Z). A filename of "-" can be used to mean "standard input", but then a mime-type must be specified.

Both the user's files (~/.mailcap; ~/.mime.types) and the system files (/etc/mailcap; /etc/mime.types) are searched in turn for information.


  see picture.jpg
  compose text/html:index.htm
  extract-mail-attachment msg.txt | see image/tiff:gzip:-


All options are in the form --<opt>=<value>.
Performs the specified action on the files. Valid actions are view, cat (uses only "copiousoutput" rules and sends output to STDOUT) , compose, composetyped, edit and print. If no action is specified, the action will be determined by how the program was called.
Turns on extra information to find out what is happening.
Ignores any "copiousoutput" directive and sends output to STDOUT.
Displays the found command without actually executing it.


A temporary symbolic link to the file is opened if the file name matches the Perl regular expression "[^[:alnum:],.:/@%^+=_-]", in order to protect from the injection of shell commands, and to make sure that the name can always be displayed in the current locale. In addition, the file is opened using its absolute path to prevent the injection of command-line arguments, for instance using file names starting with dashes.


run-mailcap (and its aliases) was written by Brian White <bcwhite [at]>.


run-mailcap (and its aliases) is in the public domain (the only true "free").


file(1) mailcap(5) mailcap.order(5) update-mime(8)