Search notes:

Shell command: xdg-mime

Determine MIME type of a file

With xdg-mime query filetype, the MIME type of a file (in the folllowing example: foo.pdf) can be determined:
$ xdg-mime query filetype foo.pdf
application/pdf

Determine the default *.desktop filename

Find the .desktop filename of the application which is registered to open application/pdf files:
$ xdg-mime query default application/pdf
okularApplication_pdf.desktop
Then:
$ grep Exec /usr/share/applications/okularApplication_pdf.desktop
Exec=okular %U
Compare with
file --brief --dereference --mime-type foo.bar

Change default application for a MIME type

$ xdg-mime default foo.desktop image/foo

See also

xdg-open and other Shell commands.
/usr/share/mime
XDG

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Linux/sh...', 1743238491, '18.221.158.39', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Linux/shell/commands/xdg/mime(67): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78