This post covers how to set default applications in Ubuntu from the command line using the mimeopen script.
ds9 is a program (stored in /home/bin/ds9) that allows astronomers to explore data (.fits files) taken at the telescope. Here's what I did to set that as the default application for opening any .fits file:
ubuntu@ubuntu:~/$ mimeopen -d 22_23.fits
Please choose a default application for files of type image/fits
1) home (home-usercreated-1)
2) Siril (org.free-astro.siril)
3) Munipack (xmunipack)
4) Atom (atom)
5) Other...
use application #5
use command: /home/bin/ds9
Opening "22_23.fits" (image/fits)
https://unix.stackexchange.com/questions/293433/where-mimeopen-saves-default-app-config
https://askubuntu.com/questions/90214/how-do-i-set-the-default-program