Determining the default file manager application under Ubuntu

The file command can be used on a Linux system to determine what type of data a file holds, e.g., file Untitled.png. You can determine the media type, aka MIME type, by using the --mime-type option for the file command. E.g., file --mime-type Untitled.png. You can determine which application is the default application for opening files of that file type using the xdg-mime command — the xdg-mime program is a command line tool that can be used to determine what application handles a particular file type. E.g., xdg-mime query default image/png — you need to specify the filetype in the "minor/major" format that xdg-mime expects, which is what you see in the output of the file --mime-type command.

$ file Documents/Untitled.png
Documents/Untitled.png: PNG image data, 597 x 113, 8-bit/color RGBA, non-interlaced
$ file --mime-type Documents/Untitled.png
Documents/Untitled.png: image/png
$ xdg-mime query default image/png
org.gnome.Loupe.desktop
$ file --mime-type Documents/Cocoa-Lead.odt
Documents/Cocoa-Lead.odt: application/vnd.oasis.opendocument.text
$ xdg-mime query default application/vnd.oasis.opendocument.text
libreoffice-writer.desktop
$

The default file manager for Ubuntu Linux is GNOME Files. You can make another application the default file manager, if you like. Some alternatives are Thunar, Nemo, Krusader, or Dolphin. You can determine which application is the default file manager with the command xdg-mime query default inode/directory. You can set the default file manager with the command xdg-mime default fmgr.desktop where fmgr is the filemanager you wish to use.

$ xdg-mime default nemo.desktop inode/directory
$ xdg-mime query default inode/directory
nemo.desktop
$ xdg-mime default thunar.desktop inode/directory
$ xdg-mime query default inode/directory
thunar.desktop
$

You can also find or update the default file manager by checking or updating the ~/.config/mimeapps.list file.

$ grep inode/directory ~/.config/mimeapps.list
inode/directory=thunar.desktop
$

You can also check on which app is currently managing the desktop/file browser using the ps command. E.g., if I wanted to check on whether any of Nautilus, Thunar, or Dolphin were running I could use the command ps aux | grep -E 'nautilus|thunar|dolphin|nemo' | grep -v 'grep'. You can check on whether a specific file manager, such as Thunar is running using the pgrep command, e.g., pgrep -a thunar.

$ ps aux | grep -E 'nautilus|thunar|dolphin|nemo' | grep -v 'grep'
lisa@ad+   35812  0.5  0.5 4234520 691816 ?      Sl   May22 299:39 /usr/bin/nautilus --gapplication-service
lisa@ad+ 1214435  0.1  0.4 4906068 560264 ?      Sl   Jun12  30:07 /usr/bin/thunar
$ grep -l "inode/directory" /usr/share/applications/*.desktop
/usr/share/applications/nemo.desktop
/usr/share/applications/org.gnome.baobab.desktop
/usr/share/applications/org.gnome.Nautilus.desktop
/usr/share/applications/org.kde.krusader.desktop
/usr/share/applications/thunar.desktop
$ pgrep -a thunar
1214435 /usr/bin/thunar
$ 

If you wish to use a different file manager than the default one, you will need to first install that file manager, which you can do from a terminal window using a sudo apt install command, e.g., sudo apt install nemo or sudo apt install thunar. You can see which file manager applications are available with the command grep -l "inode/directory" /usr/share/applications/*.desktop command.

$ grep -l "inode/directory" /usr/share/applications/*.desktop
/usr/share/applications/nemo.desktop
/usr/share/applications/org.gnome.baobab.desktop
/usr/share/applications/org.gnome.Nautilus.desktop
/usr/share/applications/org.kde.krusader.desktop
/usr/share/applications/thunar.desktop
$

You can open the default file manager and have it display the files in the current working directory by issuing the command xdg-open . in that directory. Or you can specify the directory, e.g., xdg-open $HOME.

References:

  1. How to Check the Default Application for a MIME Type on Linux
    By: Antony Sallas
    Date: September 24, 2025
    Antony Sallas

Related:

  1. Thunar on Ubuntu
    Date: May 12, 2026