MU-EXTRACT(1)
π MU-EXTRACT(1) β the "get ur attachments outta that email" page
ok so real talk, this lives in the General Commands Manual section of mu(1), and it's genuinely one of the most useful little gremlins in the whole toolbox. buckle up bestie π
β¨ NAME β¨
mu-extract β display and save message parts (attachments), and open them with other tools.
π SYNOPSIS π
mu [COMMON-OPTIONS] extract [OPTIONS] [FILE]
mu [COMMON-OPTIONS] extract [OPTIONS] FILE PATTERN
π¦ DESCRIPTION π¦
so mu extract is the mu sub-command that pulls MIME-parts (think: attachments, the good stuff) out of mail messages. it works straight on message files, which means the message does NOT need to be indexed in the database first. no database era required, we love a low-maintenance queen π
for attachments, the file name it saves under is literally the name of the attachment inside the message. if there's no such name, or if you're saving non-attachment MIME-parts, then a name gets derived from the message-id of the message. so it always gives you something to call it, periodt.
if you pass a regular expression pattern as the second argument, every attachment whose filename matches that pattern gets extracted. the regexes are basic PCRE, and they're case-sensitive by default β go read pcre(3) for the full tea.
with no options at all, mu extract just prints out the list of leaf MIME-parts in the message. and listen β only "leaf" MIME-parts count, and that includes RFC822 attachments. multipart/* and friends? ignored. they're not the moment, they're just the packaging π¦
if you don't give a filename parameter, mu extract reads the message from standard input. and in THAT case you cannot use the second, PATTERN parameter, because that would be ambiguous β instead use the --matches option. iykyk β¨
π EXTRACT OPTIONS π
-a,--save-attachmentsβ save all the MIME-parts that look like attachments. the classics, the icons.--save-allβ save all non-multipart MIME-parts. everything, no gatekeeping.--partsparts β only consider the following numbered parts (a comma-separated list, bestie). you can see the numbers for the parts by runningmu extractwith no options but only the message file. peek first, then cherry-pick π--target-dirdir β save the parts into dir instead of the current working directory.--overwriteβ overwrite existing files with the same name. by default overwriting is not allowed, so don't come crying if you didn't ask for this π-u,--uncookedβ by defaultmutransforms the attachment filenames a bit (like, replacing spaces with dashes, the way it does); with this option, it leaves that to the bare minimum needed to create a legal filename in the target directory. raw-ish, unseasoned, still legal.--matchespattern β attachments with filenames matching pattern will be extracted. same deal as before: basic PCRE, case-sensitive by default, seepcre(3)for more.--playβ try to "play" (open) the attachment with the default application for that particular file type. on MacOS this uses theopenprogram; on other platforms it usesxdg-open. you can pick a different program by setting theMU_PLAY_PROGRAMenvironment variable. main character energy for your mp3s fr fr π§
πΈ COMMON OPTIONS πΈ
-d,--debugβ makesmugenerate extra debug info, which is handy for debugging the program itself. debug info goes to the standard logging location; peepmu(1)for that.-q,--quietβ makesmunot output informational messages and progress info to standard output, only to the log file. error messages will still go to standard error. fyimu indexis much faster with--quiet, so the recommendation is to use this when you're callingmufrom scripts etc. speed + silence = slay π--log-stderrβ makesmunot output log messages to standard error, in addition to sending them to the standard logging location.--nocolorβ don't use ANSI colors. the environment variableNO_COLORcan be used as an alternative to--nocolor. sometimes you just want monochrome vibes π€-V,--versionβ printsmuversion and copyright information.-h,--helpβ lists the various command line options.
β EXAMPLES β
to display information about all the MIME-parts in a message file:
$ mu extract msgfile
to extract MIME-part 3 and 4 from this message, overwriting existing files with the same name:
$ mu extract --parts=3,4 --overwrite msgfile
to extract all files ending in .jpg (case-insensitive):
$ mu extract msgfile '.*\.jpg'
to extract an mp3-file, and play it in the default mp3-playing application:
$ mu extract --play msgfile 'whoopsididitagain.mp3'
when reading from standard-input, you need --matches, so:
$ cat msgfile | mu extract --play --matches 'whoopsididitagain.mp3'
π REPORTING BUGS π
found a bug? please report it at https://github.com/djcb/mu/issues. don't be shy, the maintainers wanna know π
π AUTHOR π
Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
π COPYRIGHT π
this manpage is part of mu 1.14.2.
Copyright Β© 2008-2026 Dirk-Jan C. Binnema. License GPLv3+: GNU GPL version 3 or later https://gnu.org/licenses/gpl.html. this is free software: you are free to change and redistribute it. there is NO WARRANTY, to the extent permitted by law. read that again bestie, NO WARRANTY, no cap π₯
π SEE ALSO π
ok that's the whole page!! this is MU EXTRACT(1) from the General Commands Manual, part of mu 1.14.2 β go forth and liberate ur attachments, you absolute icon πβ¨π
π¦ where this page comes from
- ubuntu stonking: maildir-utils 1.14.2-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms