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. (example: 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

you see lines like this:

text/html=firefox.desktop

Those “.desktop” are actual files, 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 Shell Basics

  1. Get System Info
  2. Shell Basics
  3. grep, cat, awk, uniq
  4. sort
  5. find, xargs
  6. diff Files/Dir
  7. dir size: du
  8. dir tree
  9. tar gzip bzip2 xz 7zip rar zip
  10. wget, curl, GET, HEAD
  11. rsync
  12. Install Packages

Sys Admin

  1. Job Control
  2. ps
  3. top
  4. htop
  5. RAM stat
  6. Users and Groups
  7. File Permission
  8. Opened Files: lsof
  9. shutdown, sleep

Bash/Terminal

  1. Bash Keys, Terminal Keys, Man Page Keys
  2. Bash Prompt Setup
  3. Bash Color Prompt
  4. .bashrc, .profile, .bash_profile
  5. Virtual Console
  6. Terminal Control Sequence Keys
  7. Reset Terminal
  8. tmux
  9. man page
  10. Bash Manual in Chapters
  11. BASH Shell Misc Tips
  12. Log Terminal Session

Linux Desktop

  1. Most Useful GUI Apps
  2. Set Default App
  3. Shell Commands for GUI Apps
  4. Image Viewers
  5. Music Players
  6. Move File to Trash by Command
  7. X11 Selection and Clipboard
  8. How to Switch to LXDE, Xfce
  9. LXDE Keyboard Shortcuts
  10. LXDE/Openbox, Change Keyboard Shortcuts
  11. LXDE Set Key Repeat Rate
  12. LXDE/OpenBox, Disable Mouse Scroll Wheel Hide Window
  13. Xfce Keyboard Shortcuts
  14. Xfce Good Themes
  15. xmonad Keybinding
  16. How to Restart X11
  17. Why Tiling Window Manager Sucks
  18. Standard Fonts
  19. How to Install Font

If you have a question, put $5 at patreon and message me.