LinuxCommandLibrary

mimeopen.

Open files with associated applications

SYNOPSIS

mimeopen [options]

PARAMETERS

-d, --default
    Use the default application for the MIME type.

-n, --no-ask
    Do not ask the user to choose an application, but use the default one.

-o , --open-with
    Open with the specified command (command should contain %s to represent the file name).

-s, --show-path
    Show the full path of the application.

-V, --version
    Display version information.

-h, --help
    Display help text.

DESCRIPTION

The mimeopen command allows you to open a file using its associated application based on the file's MIME type. It queries the system's MIME type database and presents you with a list of possible applications that can handle the file.

This is particularly useful for files where the associated application isn't immediately obvious or where you want to choose a different application than the default. It provides a user-friendly way to handle files in a graphical environment from the command line. It operates primarily within the context of a desktop environment like GNOME, KDE, or XFCE, and relies on their respective MIME handling systems.

mimeopen is part of the `shared-mime-info` package and relies on the system's MIME database for accurate file type detection and application associations. It aims to simplify the process of opening files with the correct program by leveraging the desktop environment's existing MIME-type infrastructure.

CAVEATS

Requires a graphical desktop environment (GNOME, KDE, XFCE, etc.) and relies on the underlying MIME database. May not function correctly in purely command-line environments without X server running. Requires shared-mime-info package installed.

MIME TYPE ASSOCIATION

MIME types are used to identify the type of data contained within a file. The `mimeopen` command uses this information to determine which applications are capable of opening the file. The system's MIME database is typically located in `/usr/share/mime`.

COMMAND SUBSTITUTION

When using the `-o` option, the `%s` placeholder will be replaced with the full path to the file being opened. This allows you to pass the file as an argument to the specified command.

SEE ALSO

xdg-open(1), gio(1)

Copied to clipboard