Linux: Set Default App

By Xah Lee. Date: . Last updated: .

Here's how to set default apps.

There are many ways to set default app, it depends on which linux desktop you are using. (e.g. Ubuntu, Lubuntu/LXDE, Xubuntu/Xfce.)

You may need to try a few of the following methods on your system.

Set Default App by GUI

Set Default Browser

in terminal, type exo-preferred-applications.

exo-preferred-applications → command to open a Graphical User Interface for setting default {browser, email, terminal, file manager}.

linux exo preffered apps browser
Set default browser by exo-preferred-applications

Set Default Terminal, File Manager

Click on the Utilities tab.

linux exo preffered apps terminal
Set default app by exo-preferred-applications

Set Default Image Viewer

You can right click on a file, select “Properties”, then choose the app you want.

linux file property menu
Right-click on file for the property menu.
linux file property dialog
property dialog.

(this is thunar file manager, as of .)

Lubuntu/LXDE Set Default App

lxde set default app 2017 02 21
lxsession-default-apps

in terminal, type

lxsession-default-apps

to launch the GUI app.

Set Default App Command Line

Edit this file ~/.local/share/applications/mimeapps.list

Here's sample file content:

[Default Applications]
x-scheme-handler/http=firefox.desktop
x-scheme-handler/https=firefox.desktop
x-scheme-handler/ftp=firefox.desktop
x-scheme-handler/chrome=firefox.desktop
text/html=firefox.desktop
application/x-extension-htm=firefox.desktop
application/x-extension-html=firefox.desktop
application/x-extension-shtml=firefox.desktop
application/xhtml+xml=firefox.desktop
application/x-extension-xhtml=firefox.desktop
application/x-extension-xht=firefox.desktop
image/jpeg=gthumb.desktop
image/svg+xml=inkscape.desktop
video/mp4=vlc.desktop
video/quicktime=vlc.desktop
video/mpeg=vlc.desktop
image/png=gthumb.desktop
application/epub+zip=userapp-fbreader-K2ECYW.desktop
application/vnd.ms-htmlhelp=xchm.desktop
image/bmp=gpicview.desktop
image/gif=eog.desktop
image/jpg=gpicview.desktop
image/tiff=gpicview.desktop
image/x-bmp=gpicview.desktop

Here's the file on my machine (as of )

mimeapps.list

the global one is at /usr/share/applications/defaults.list

The “.desktop” files are at:

The “.desktop” files are a map between app icons to the command line.

For example, here's emacs one at /usr/share/applications/emacs24.desktop

[Desktop Entry]
Version=1.0
Name=GNU Emacs 24
GenericName=Text Editor
Comment=View and edit files
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=/usr/bin/emacs24 %F
TryExec=emacs24
Icon=/usr/share/icons/hicolor/scalable/apps/emacs24.svg
Type=Application
Terminal=false
Categories=Utility;Development;TextEditor;
StartupWMClass=Emacs24

Set generic browser icon to your preferred browser

in terminal, run sudo update-alternatives --config x-www-browser

Here's sample session.

◆ xah@xah-p6813w◆ 2015-12-07 06:08 ◆ ~
◆ sudo update-alternatives --config x-www-browser
[sudo] password for xah:
There are 4 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser).

  Selection    Path                           Priority   Status
------------------------------------------------------------
* 0            /usr/bin/google-chrome-stable   200       auto mode
  1            /usr/bin/chromium-browser       40        manual mode
  2            /usr/bin/firefox                40        manual mode
  3            /usr/bin/google-chrome-stable   200       manual mode
  4            /usr/bin/opera                  120       manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/firefox to provide /usr/bin/x-www-browser (x-www-browser) in manual mode.

Linux Desktop Topic

  1. Linux: How to Switch to LXDE, Xfce
  2. Linux: LXDE Keyboard Shortcuts
  3. Linux: LXDE/Openbox, Change Keyboard Shortcuts
  4. Linux: LXDE Set Key Repeat Rate
  5. Linux: LXDE/OpenBox, Disable Mouse Scroll Wheel Hide Window
  6. Linux: Xfce Keyboard Shortcuts
  7. Linux: Xfce Good Themes
  8. Linux: xmonad Keybinding
  9. Why Tiling Window Manager Sucks (xmonad, ratpoison, dwm, …)


  1. Linux: Set Default App
  2. Linux: Shell Commands for GUI Apps
  3. Linux: Image Viewers
  4. Linux: Move File to Trash by Command