# how to use mutt in ubuntu for reading mail from mbox files
To read mail from an mbox file on Ubuntu using **Mutt**, you can pass the file path directly to the `mutt` command using the `-f` flag. Since Mutt natively autodetects the mbox format, you do not need to configure an email server or complex configuration files to read a local mbox archive. [[1](https://www.systutorials.com/how-to-view-mbox-files-on-linux/), [2](http://www.rdrop.com/docs/mutt/manual58.html)]
1. Install Mutt
Ensure Mutt is installed on your Ubuntu system using the Advanced Package Tool (APT): [[1](https://mritunjaysharma394.medium.com/how-to-set-up-mutt-text-based-mail-client-with-gmail-993ae40b0003)]
bash
``` sudo apt update && sudo apt install mutt ```
Use code with caution.
2. Open the mbox File
Launch Mutt and point it directly to your target `.mbox` file: [[1](https://www.systutorials.com/how-to-view-mbox-files-on-linux/)]
bash
``` mutt -f /path/to/your/file.mbox ```
Use code with caution.
- **Tip:** If you only want to view the messages without risk of accidental changes or deletions, open it in read-only mode using the `-R` flag:
bash
``` mutt -R -f /path/to/your/file.mbox ```
Use code with caution.
\[[1](https://www.tecmint.com/send-mail-from-command-line-using-mutt-command/), [2](https://www.tecmint.com/send-mail-from-command-line-using-mutt-command/), [3](https://manpages.ubuntu.com/manpages/jammy/man1/chewmail.1.html)\]
3. Essential Navigation Keyboard Shortcuts
Once Mutt loads the interactive terminal interface, use these standard shortcuts to browse the archive: [[1](https://www.youtube.com/watch?v=jTPa7vWNAS8), [2](https://unix.stackexchange.com/questions/762781/how-to-view-sent-messages-in-mutt-using-the-default-mbox-format)]
- `↑` / `↓` (or `k` / `j`): Scroll through the message index list. - `Enter` (or `Space`): Open and read the highlighted email. - `i`: Exit the email body view and return to the main index list. - `d`: Mark an email for deletion (only applies if you didn't use the read-only flag). - `c`: Change to a different folder or switch to another mbox file without closing Mutt. - `q`: Quit Mutt. \[[1](https://www.linux.com/news/fetching-email-mutt/), [2](https://www.cubexsoft.com/blog/how-to-search-content-inside-mbox-files/?srsltid=AfmBOor6O_Dzz-IflFR0yJ8yEvbskQ8BPzwL-sAOFZYOEfpLzzcyNFFB), [3](https://www.youtube.com/watch?v=jTPa7vWNAS8), [4](https://unix.stackexchange.com/questions/762781/how-to-view-sent-messages-in-mutt-using-the-default-mbox-format)\]
4. Optional Configuration (Fixing HTML emails)
Many modern mbox files contain HTML formatting that looks cluttered in a plain-text terminal. You can make Mutt auto-convert HTML emails to text using an external text browser like `lynx` or `w3m`. [[1](https://cri.dev/posts/2021-02-18-read-mbox-gmail-export-linux-mutt-thunderbird/), [2](https://www.cigatisolutions.com/blog/convert-mbox-to-html/), [3](https://lists.debian.org/debian-user/2024/12/msg01078.html), [4](https://www.reddit.com/r/linux/comments/9c3wco/mutt_and_html_emails/), [5](https://lwn.net/Articles/837960/)]
Create or edit your local config file at `~/.muttrc` or `~/.config/mutt/muttrc` and add the following lines: [[1](https://www.youtube.com/watch?v=2jMInHnpNfQ), [2](https://manpages.ubuntu.com/manpages/xenial/man5/muttrc-org.5.html), [3](https://anjibabuiitk.github.io/Send-Mail-from-Terminal/)]
text
``` auto_view text/html alternative_order text/plain text/html ```
Use code with caution.
Ensure your system's global mailcap file (`/etc/mailcap`) has an entry handling `text/html`, which is standard across Ubuntu installations. [[1](https://manpages.ubuntu.com/manpages/xenial/man5/muttrc-org.5.html)]
If you plan to use this setup frequently, let me know if you would like to **automate sorting** by thread, or if you need help **extracting attachments** from the mbox file