I love lynx. I love browsing without tabs. Call me a luddite, but I only use a modern browser if I have to. Which is about twice a day, for a few minutes at most.

There's one thing I really really hate about lynx, though. It's not immediately apparent how to customize lynx's behavior when it comes to filetypes.

If I encounter a .pdf file, it downloads it, then dutifully asks me if I'd like to save it to disk. Thanks, lynx. It's like you read my mind or something.

If I encounter a .torrent file, lynx downloads it, then opens it with transmission-gtk.

Uh... no, lynx. I would have either preferred transmission-cli or just having the torrent file.

If I try to open a magnet URL, lynx doesn't know what to do with it. (Psst! transmission-cli, lynx!

But the worst is when I download .ogg, because lynx assumes that I want to play it with VLC in the TTY using caca to render the video as ASCII.

Bad lynx!

How do I whip lynx into shape? How do I customize this behavior? Editing /etc/lynx/lynx.cfg does not seem to do the trick.

  • 2
    Lynx uses mailcap(5) to display non-HTML stuff. Have you considered using elinks or w3m? – Stéphane Chazelas Feb 10 '13 at 21:18
  • 1
    Have you tried sending lynx to bed with no dinner? – terdon Feb 11 '13 at 2:39

Lynx does the standard thing (unlike Firefox and Chrome) and uses the system's mailcap database. The system mailcap is in /etc/mailcap, and the per-user file is ~/.mailcap. Add entries like

application/x-bittorrent; transmission-cli '%s'; needsterminal
application/pdf; pdftotext '%s'; copiousoutput
application/ogg; vlc '%s'; test=test -n "$DISPLAY"

As noted, Lynx uses the standard mime-types and mailcap files to decide what a file's type is and how to present it, allowing customization by the user.

The locations of the system- and user-mailcap files are configurable (in lynx.cfg):

and the mime-type files likewise are configurable:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.