Mime

From miki
Revision as of 17:59, 17 May 2019 by Mip (talk | contribs) (Created page with "== Overview == Use <code>mimetype</code> to view the MIME type of a file <source lang="bash"> mimetype myfile.svg # myfile.svg: image/svg+xml </source> To change default appl...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

Use mimetype to view the MIME type of a file

mimetype myfile.svg
# myfile.svg: image/svg+xml

To change default application for a given MIME type:

  • For user, edit ~/.mailcap:
image/svg+xml; /usr/bin/chromium %s; test=test -n "$DISPLAY"
  • System-wide, edit /etc/mailcap.order, then run sudo update-mime:
evince:application/pdf

Other relevant information:

man mimetype
man mimeview
man mimeopen           # Apparently not same as "see"
man see

Troubleshooting

Open PDF files with Evince (instead of Gimp)

On recent Debian / Ubuntu releases, PDF files are opened by Gimp instead of the PDF viewer, like Evince.

To fix the issue system-wide:

  • Create a MIME entry for evince [1]:
echo 'application/pdf; evince %s; test=test -n "$DISPLAY"' | sudo tee /usr/lib/mime/packages/evince
  • Change MIME order in /etc/mailcap.order:
echo 'evince:application/pdf'| sudo tee -a /etc/mailcap.order
sudo update-mime