{
    "content": [
        {
            "type": "text",
            "text": "# XDG-MIME(1) (man)\n\n**Summary:** xdg-mime - command line tool for querying information about file type handling and adding descriptions for new file types\n\n**Synopsis:** xdg-mime query {filetype | default} ...\nxdg-mime default application mimetype(s)\nxdg-mime install [--mode mode] [--novendor] mimetypes-file\nxdg-mime uninstall [--mode mode] mimetypes-file\nxdg-mime {--help | --manual | --version}\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| — | --novendor | — | Normally, xdg-mime checks to ensure that the mimetypes-file to be installed has a proper vendor prefix. This option can  |\n| — | --help | — | Show command synopsis. |\n| — | --manual | — | Show this manual page. |\n| — | --version | — | Show the xdg-utils version information. |\n\n## Examples\n\n- `xdg-mime query filetype /tmp/foobar.png`\n- `Prints the MIME type of the file /tmp/foobar.png, in this case image/png`\n- `xdg-mime query default image/png`\n- `Prints the .desktop filename of the application which is registered to open PNG files.`\n- `xdg-mime install shinythings-shiny.xml`\n- `Adds a file type description for \"shiny\"-files. \"shinythings-\" is used as the vendor prefix.`\n- `The file type description could look as follows.`\n- `shinythings-shiny.xml:`\n- `<?xml version=\"1.0\"?>`\n- `<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>`\n- `<mime-type type=\"text/x-shiny\">`\n- `<comment>Shiny new file type</comment>`\n- `<glob pattern=\"*.shiny\"/>`\n- `<glob pattern=\"*.shi\"/>`\n- `</mime-type>`\n- `</mime-info>`\n- `An icon for this new file type must also be installed, for example with:`\n- `xdg-icon-resource install --context mimetypes --size 64 shiny-file-icon.png text-x-shiny`\n\n## See Also\n\n- xdg-icon-resource(1)\n- xdg-desktop-menu(1)\n\n## Section Outline\n\n- **NAME** (3 lines)\n- **SYNOPSIS** (10 lines)\n- **DESCRIPTION** (3 lines)\n- **COMMANDS** (47 lines)\n- **OPTIONS** (8 lines) — 4 subsections\n  - --novendor (8 lines)\n  - --help (2 lines)\n  - --manual (2 lines)\n  - --version (2 lines)\n- **ENVIRONMENT VARIABLES** (10 lines)\n- **EXIT CODES** (18 lines)\n- **SEE ALSO** (3 lines)\n- **EXAMPLES** (29 lines)\n- **AUTHORS** (1 lines) — 2 subsections\n  - Kevin Krammer (2 lines)\n  - Jeremy White (2 lines)\n- **COPYRIGHT** (2 lines)\n- **NOTES** (9 lines)\n\n## Full Content\n\n### NAME\n\nxdg-mime - command line tool for querying information about file type handling and adding\ndescriptions for new file types\n\n### SYNOPSIS\n\nxdg-mime query {filetype | default} ...\n\nxdg-mime default application mimetype(s)\n\nxdg-mime install [--mode mode] [--novendor] mimetypes-file\n\nxdg-mime uninstall [--mode mode] mimetypes-file\n\nxdg-mime {--help | --manual | --version}\n\n### DESCRIPTION\n\nThe xdg-mime program can be used to query information about file types and to add\ndescriptions for new file types.\n\n### COMMANDS\n\nquery\nReturns information related to file types.\n\nThe query option is for use inside a desktop session only. It is not recommended to use\nxdg-mime query as root.\n\nThe following queries are supported:\n\nquery filetype FILE: Returns the file type of FILE in the form of a MIME type.\n\nquery default mimetype: Returns the default application that the desktop environment uses\nfor opening files of type mimetype. The default application is identified by its\n*.desktop file.\n\ndefault\nAsk the desktop environment to make application the default application for opening files\nof type mimetype. An application can be made the default for several file types by\nspecifying multiple mimetypes.\n\napplication is the desktop file id of the application and has the form\nvendor-name.desktop.  application must already be installed in the desktop menu before it\ncan be made the default handler. The application's desktop file must list support for all\nthe MIME types that it wishes to be the default handler for.\n\nRequests to make an application a default handler may be subject to system policy or\napproval by the end-user. xdg-mime query can be used to verify whether an application is\nthe actual default handler for a specific file type.\n\nThe default option is for use inside a desktop session only. It is not recommended to use\nxdg-mime default as root.\n\ninstall\nAdds the file type descriptions provided in mimetypes-file to the desktop environment.\nmimetypes-file must be a XML file that follows the freedesktop.org Shared MIME-info\nDatabase specification and that has a mime-info element as its document root. For each\nnew file type one or more icons with name type-subtype must be installed with the\nxdg-icon-resource command in the mimetypes context. For example the filetype\napplication/vnd.oasis.opendocument.text requires an icon named\napplication-vnd.oasis.opendocument.text to be installed (unless the file type recommends\nanother icon name).\n\nuninstall\nRemoves the file type descriptions provided in mimetypes-file and previously added with\nxdg-mime install from the desktop environment.  mimetypes-file must be a XML file that\nfollows the freedesktop.org Shared MIME-info Database specification and that has a\nmime-info element as its document root.\n\n### OPTIONS\n\n--mode mode\nmode can be user or system. In user mode the file is (un)installed for the current user\nonly. In system mode the file is (un)installed for all users on the system. Usually only\nroot is allowed to install in system mode.\n\nThe default is to use system mode when called by root and to use user mode when called by\na non-root user.\n\n#### --novendor\n\nNormally, xdg-mime checks to ensure that the mimetypes-file to be installed has a proper\nvendor prefix. This option can be used to disable that check.\n\nA vendor prefix consists of alpha characters ([a-zA-Z]) and is terminated with a dash\n(\"-\"). Companies and organizations are encouraged to use a word or phrase, preferably the\norganizations name, for which they hold a trademark as their vendor prefix. The purpose\nof the vendor prefix is to prevent name conflicts.\n\n#### --help\n\nShow command synopsis.\n\n#### --manual\n\nShow this manual page.\n\n#### --version\n\nShow the xdg-utils version information.\n\n### ENVIRONMENT VARIABLES\n\nxdg-mime honours the following environment variables:\n\nXDGUTILSDEBUGLEVEL\nSetting this environment variable to a non-zero numerical value makes xdg-mime do more\nverbose reporting on stderr. Setting a higher value increases the verbosity.\n\nXDGUTILSINSTALLMODE\nThis environment variable can be used by the user or administrator to override the\ninstallation mode. Valid values are user and system.\n\n### EXIT CODES\n\nAn exit code of 0 indicates success while a non-zero exit code indicates failure. The\nfollowing failure codes can be returned:\n\n1\nError in command line syntax.\n\n2\nOne of the files passed on the command line did not exist.\n\n3\nA required tool could not be found.\n\n4\nThe action failed.\n\n5\nNo permission to read one of the files passed on the command line.\n\n### SEE ALSO\n\nxdg-icon-resource(1), xdg-desktop-menu(1), Shared MIME database specification[1], MIME\napplications associations specification[2]\n\n### EXAMPLES\n\nxdg-mime query filetype /tmp/foobar.png\n\nPrints the MIME type of the file /tmp/foobar.png, in this case image/png\n\nxdg-mime query default image/png\n\nPrints the .desktop filename of the application which is registered to open PNG files.\n\nxdg-mime install shinythings-shiny.xml\n\nAdds a file type description for \"shiny\"-files. \"shinythings-\" is used as the vendor prefix.\nThe file type description could look as follows.\n\nshinythings-shiny.xml:\n\n<?xml version=\"1.0\"?>\n<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>\n<mime-type type=\"text/x-shiny\">\n<comment>Shiny new file type</comment>\n<glob pattern=\"*.shiny\"/>\n<glob pattern=\"*.shi\"/>\n</mime-type>\n</mime-info>\n\nAn icon for this new file type must also be installed, for example with:\n\nxdg-icon-resource install --context mimetypes --size 64 shiny-file-icon.png text-x-shiny\n\n### AUTHORS\n\n#### Kevin Krammer\n\nAuthor.\n\n#### Jeremy White\n\nAuthor.\n\n### COPYRIGHT\n\nCopyright © 2006\n\n### NOTES\n\n1. Shared MIME database specification\nhttp://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec/\n\n2. MIME applications associations specification\nhttp://www.freedesktop.org/wiki/Specifications/mime-apps-spec/\n\n\n\nxdg-utils 1.0                                08/22/2022                                  XDG-MIME(1)\n\n"
        }
    ],
    "structuredContent": {
        "command": "XDG-MIME",
        "section": "1",
        "mode": "man",
        "summary": "xdg-mime - command line tool for querying information about file type handling and adding descriptions for new file types",
        "synopsis": "xdg-mime query {filetype | default} ...\nxdg-mime default application mimetype(s)\nxdg-mime install [--mode mode] [--novendor] mimetypes-file\nxdg-mime uninstall [--mode mode] mimetypes-file\nxdg-mime {--help | --manual | --version}",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [
            {
                "flag": "",
                "long": "--novendor",
                "arg": null,
                "description": "Normally, xdg-mime checks to ensure that the mimetypes-file to be installed has a proper vendor prefix. This option can be used to disable that check. A vendor prefix consists of alpha characters ([a-zA-Z]) and is terminated with a dash (\"-\"). Companies and organizations are encouraged to use a word or phrase, preferably the organizations name, for which they hold a trademark as their vendor prefix. The purpose of the vendor prefix is to prevent name conflicts."
            },
            {
                "flag": "",
                "long": "--help",
                "arg": null,
                "description": "Show command synopsis."
            },
            {
                "flag": "",
                "long": "--manual",
                "arg": null,
                "description": "Show this manual page."
            },
            {
                "flag": "",
                "long": "--version",
                "arg": null,
                "description": "Show the xdg-utils version information."
            }
        ],
        "examples": [
            "xdg-mime query filetype /tmp/foobar.png",
            "Prints the MIME type of the file /tmp/foobar.png, in this case image/png",
            "xdg-mime query default image/png",
            "Prints the .desktop filename of the application which is registered to open PNG files.",
            "xdg-mime install shinythings-shiny.xml",
            "Adds a file type description for \"shiny\"-files. \"shinythings-\" is used as the vendor prefix.",
            "The file type description could look as follows.",
            "shinythings-shiny.xml:",
            "<?xml version=\"1.0\"?>",
            "<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>",
            "<mime-type type=\"text/x-shiny\">",
            "<comment>Shiny new file type</comment>",
            "<glob pattern=\"*.shiny\"/>",
            "<glob pattern=\"*.shi\"/>",
            "</mime-type>",
            "</mime-info>",
            "An icon for this new file type must also be installed, for example with:",
            "xdg-icon-resource install --context mimetypes --size 64 shiny-file-icon.png text-x-shiny"
        ],
        "see_also": [
            {
                "name": "xdg-icon-resource",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/xdg-icon-resource/1/json"
            },
            {
                "name": "xdg-desktop-menu",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/xdg-desktop-menu/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "COMMANDS",
                "lines": 47,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 8,
                "subsections": [
                    {
                        "name": "--novendor",
                        "lines": 8,
                        "long": "--novendor"
                    },
                    {
                        "name": "--help",
                        "lines": 2,
                        "long": "--help"
                    },
                    {
                        "name": "--manual",
                        "lines": 2,
                        "long": "--manual"
                    },
                    {
                        "name": "--version",
                        "lines": 2,
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "ENVIRONMENT VARIABLES",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "EXIT CODES",
                "lines": 18,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 29,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Kevin Krammer",
                        "lines": 2
                    },
                    {
                        "name": "Jeremy White",
                        "lines": 2
                    }
                ]
            },
            {
                "name": "COPYRIGHT",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 9,
                "subsections": []
            }
        ]
    }
}