Like many features to do with the desktop, default applications are governed by one of many Freedesktop specifications.
Your distribution likely provides xdg-open, which programs will use to open the default application for a file.
You can use it directly like this:
xdg-open file.html
If you want to know the default application used for opening a particular filetype, first get the filetype with xdg-mime:
xdg-mime query filetype file.html
You’ll get:
text/html
Now you can query the default application used for that filetype:
xdg-mime query default text/html
The output might be:
chromium.desktop
At this point, you might be wondering what the .desktop extension means. These are Desktop Entries, defined by the Freedesktop Desktop Entry Specification.desktop entries are files that describe an application; namely, the name of the application, the name of the icons it uses, and how to launch it.
.desktop entries are stored in several locations. You’ll find your system .desktop entries at /usr/share/applications. You’ll find your local .desktop entries at ~/.local/share/applications.
There are more locations your .desktop entries might be. For example, if you install an application via Flatpak, you can use the $XDG_DATA_DIRS environment variable to find out where they are:
echo $XDG_DATA_DIRS
To set a new default application for this filetype, you need to know the name of the .desktop entry for the application you want to use.
So, if we want to use Firefox, we want to do something like this:
ls /usr/share/applications | grep -i firefox
That gives me:
firefox.desktop
If you installed Firefox another way, you might get nothing at all. The desktop entry might be located in ~/.local/share/applications and named something different, or somewhere else altogether.
Now that we know the name, we can set it as the default application for text/html files:
xdg-mime default firefox.desktop text/html
And now if you try to open that .html file with xdg-open, it will open in Firefox:
xdg-open file.html
Applications using xdg-open to determine the default filetype for .html files will also now open them in Firefox for you through xdg-open.
And that’s all there is to it!
Looking to dive into Desktop Linux?
A Guide to Desktop Linux in 2025, available for purchase as an eBook and in Print, is just the handbook you need to orient you on this journey.
Whether you're worried Windows no longer has your best interests at heart, or you're just plain curious, this guide will help you get up and running while avoiding all of the usual potholes and footguns along the way.
If you tried Linux a long time ago, you'll be glad to know all aspects of the desktop have only gotten better over time. You might not even recognise it!
It's not 1998 anymore. It's been over 30 years since Linux was first released, and the Linux Desktop has undergone seismic shifts in usability and capability over the years. This book is designed for the modern age and helps you take advantage of all the latest technology available for desktop Linux. Even if you've used Linux before, things have changed a lot in just the last few years.
That's not to say the Linux Desktop isn't as quirky as it has ever been, but the jankiness has been sanded off in many areas. There's plenty you can do on Linux, and yet it would be a lie to say there isn't a cost to that freedom most of your penguin friends aren't forthcoming about. This guide acknowledges the limitations of the Linux world and doesn't try to hide them from you.
In this book, you'll find chapters about:
- getting your new Linux distribution setup on your computer
- providing step-by-step guidance for installation, software compatibility,
- gaming, and productivity
- exploring the history of desktop Linux
- the bright yet uncertain future of Linux
Buy this book now and dip your toes into the weird and wonderful world of Desktop Linux. Just don’t blame me when your house starts filling up with penguin plushies and red hats.
Written by
James North
Project Manager and Company Director at Evolvepreneur.
Part-time system administrator for Evolve Systems Group.
Part-time writer and author of A Guide to Desktop Linux in 2025.
Symfony developer.
You Might Also Like
How to create professional audiobook .m4b files in under a minute using your WEB BROWSER!
James North
May 31, 2026

Comments (0)
No comments yet. Be the first to comment!