default_type - Linux


default_type is a versatile tool used to manage system and user MIME types. MIME (Multipurpose Internet Mail Extensions) types associate specific file extensions with their corresponding applications. default_type allows users to view, set, and modify these associations, enabling seamless file handling and application launching.


default_type [-a | -r] [--list-mimetypes] [--list-extensions] [--mime-type FILETYPE] [--extension MIMETYPE] [--user [USERNAME]]


  • -a, –association: Display all registered MIME type associations.
  • -r, –remove: Remove a specific MIME type association.
  • –list-mimetypes: List all registered MIME types.
  • –list-extensions: List all known file extensions associated with MIME types.
  • –mime-type FILETYPE: Set the MIME type for the specified file extension.
  • –extension MIMETYPE: Set the file extension for the specified MIME type.
  • –user [USERNAME]: Set or modify MIME type associations for the specified user. Defaults to the current user.


View MIME Type Associations

default_type -a

Set MIME Type for File Extension

# Set PDF files to open with Evince
default_type --mime-type application/pdf .pdf

Remove MIME Type Association

# Remove the association between .txt files and the gedit editor
default_type -r application/x-extension-txt .txt

Common Issues

  • Error setting MIME type: Ensure you have sufficient permissions to modify MIME type associations. Use sudo before default_type if necessary.
  • Unable to open file with desired application: Verify that the correct MIME type association is set and that the application is installed and accessible.


default_type can be combined with other commands and utilities for advanced tasks:

  • xargs + default_type: Set MIME types for multiple file types in bulk.
  • find + default_type: Modify MIME type associations based on file path or other criteria.

Related Commands

  • xdg-mime: Manage MIME types system-wide.
  • file: Identify file types based on their content.