Forrest logo
back to the xdg-mime tool

xdg-mime:tldr:a9712

xdg-mime: Display the MIME type of a file.
$ xdg-mime query filetype ${filename}
try on your machine

The command "xdg-mime query filetype ${filename}" is used to query the MIME (Multipurpose Internet Mail Extensions) type of a given file.

Here's a breakdown of the command:

  1. "xdg-mime": It is a command-line tool used in desktop environments to query and manipulate MIME types.

  2. "query": This specific subcommand is used to request information about a particular file or MIME type.

  3. "filetype": It specifies the information to be queried is the MIME type.

  4. "${filename}": This is a placeholder for the actual name of the file you want to check the MIME type of. You need to replace "${filename}" with the actual filename and path (if necessary) of the file you want to query.

When you run this command in a Linux or Unix terminal, it will return the MIME type of the given file. The MIME type represents the nature and format of the file contents and is used by the desktop environment to determine which program should be used to open the file.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the xdg-mime tool