<SOLVED> Is it possible/how could I change default software launcher for specific file extensions through the terminal?
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
<SOLVED> Is it possible/how could I change default software launcher for specific file extensions through the terminal?
Is there a terminal command for me to change the default software for launching specific file extensions or not recommendable/only possible through the desktop environment?
Last edited by d186 on Sat Mar 23, 2024 5:27 pm, edited 1 time in total.
Re: Is it possible/how could I change default software launcher for specific file extensions through the terminal?
Yes, there is a 2 step process:
1) First you have to find out the MIME type for file with that extension. Open a terminal in a directory where you have such a file and run the command
2) Then find the .desktop file for the program you want to set as default. You can usually find them in /usr/share/applications and by checking the files list of the program's package and getting the name of the .desktop file from that. Then you can run
You can see the current default with
1) First you have to find out the MIME type for file with that extension. Open a terminal in a directory where you have such a file and run the command
xdg-mime query filetype filename
where you replace "filename" with the filename. You can press Tab key to auto-complete partially typed filenames. The command will reply the MIME type of the file.2) Then find the .desktop file for the program you want to set as default. You can usually find them in /usr/share/applications and by checking the files list of the program's package and getting the name of the .desktop file from that. Then you can run
xdg-mime default application mimetype
where you replace "application" with the name of the .desktop file (just its filename, not the path) and "mimetype" with the MIME type you got in step 1.You can see the current default with
xdg-mime query default mimetype
where your replace "mimetype" with the MIME type you got in step 1.