How can I do right click > File > Properties > Open with > Set as default in the terminal?

I created a java app and an installation script for it. I would like to run my app by double click. So I create myProgram.desktop file in /usr/share/applications/ (I did it because base JRE.desktop is using the wrong working directory). If I set it up in the GUI, everything is working, but I am not able to do it from the terminal (basically from my script).


To make a default application that opens a file from the GUI do the following:

  1. Right click on the file and choose properties.
  2. Select the open With tab.
  3. Select your desired application
  4. Click Set as Default
  • 2
    Thanks for the response. I know that, but my question is: How to do it from the terminal? – user7431421 Apr 7 '17 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.