How to change default open with application for any type of file on Linux Ubuntu using a simple command in terminal
With the new Ubuntu 23.04 release I found myself struggling to find a valid answer to a very simple task. I own a 3D printer and I design stuff in FreeCAD, then export to STL and load this in Cura to slice it and produce gcode for printer. If in Windows 11 there is a 3D viewer application which opens STL files, Ubuntu doesn't come bundled with a similar app and I hate loading every STL file in Cura just to see the 3D model. However, there is fstl, which I found it to be exactly what I was looking for: it is lightweight and it opens STL files.
I installed it from default repositories with sudo apt install fstl. Although this is a GUI app, it can only be started from command line, having no desktop entry to open it from Apps. I didn't have a problem with this, since I knew I could select any executable to open a file with. However, this is is no longer true. The Open With dialog no longer allows users to choose something else besides installed applications.
![]() |
Open With dialog in new Ubuntu versions |
There is no option to choose something else. Neither here, neither if I open file properties. So I did the first thing: performed an internet search on how to change default open with app for a file in Ubuntu. Unfortunately, I was really disappointed with the results.
All Linux/Ubuntu how-to sites told me the same things:
- Right-click file, select Open With and choose another application. Ok, but what I do if I don't have the app I want in that list?
- Right-click file, select Properties and change it from there. This option is no longer there, or I suddenly go blind when I open that dialog.
- Open Settings, go to Default Apps and change as you like. Useless, I don't want to change common web, mail, calendar, music, video and photos defaults.
- Open a terminal (this already seemed promising) and run sudo update-alternatives --all. No way!
![]() |
File Properties dialog in Files app |
Now, after this long introduction, here is the terminal command which does exactly what I needed:
mimeopen -d your_stl_file.stl
Just point it to an existing STL file. Type 3 to select another application, then write the name or full path to that application. It is as simple as this. I had to check fstl GitHub page to find this, because all the other how-to's failed to show me this. This is its output:
Please choose a default application for files of type model/stl 1) UltiMaker Cura (5.4.0) (appimagekit_a4a62d92a77ef06111291d2741567faa-UltiMaker_Cura) 2) FreeCAD (org.freecadweb.FreeCAD) 3) Other... use application #3 use command: fstl
It automatically sets the default app for opening similar files. This was a case where the most obvious solution was not easy to find. However, now I can double-click STL files and have them opened it fstl.
No comments :
Post a Comment
Please read the comments policy before publishing your comment.