I want to set sublime text as my default app to open files like .cpp and .java, however any of my application lists in "Select Application" do not show sublime text.
I tried the method in this link but it didn't work: Change all associations from gedit to another application
Is there any alternative method?
Here is the output of a few related commands, if this helps:
$ ls -al /usr/share/applications/*sublime*
-rw-r--r-- 1 root root 230 Aug 8 23:50 /usr/share/applications/sublime.desktop
-rw-r--r-- 1 root root 532 Sep 23 2016 /usr/share/applications/sublime_text.desktop
$ ls -al /usr/local/share/applications/*sublime*
ls: cannot access '/usr/local/share/applications/*sublime*': No such file or directory
$ ls -al /opt
total 20
drwxr-xr-x 5 root root 4096 Aug 8 23:58 .
drwxr-xr-x 25 root root 4096 Aug 11 08:07 ..
drwxr-xr-x 3 root root 4096 Apr 21 16:02 google
drwxr-xr-x 5 root root 4096 Jul 14 2012 sublime
drwxr-xr-x 4 root root 4096 Aug 8 23:58 sublime_text
$ cat /usr/local/share/applications/sublime*.desktop
cat: '/usr/local/share/applications/sublime*.desktop': No such file or directory
$ cat /usr/share/applications/sublime_text.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=/opt/sublime_text/sublime_text %F
Terminal=false
MimeType=text/plain;
Icon=sublime-text
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;
[Desktop Action Window]
Name=New Window
Exec=/opt/sublime_text/sublime_text -n
OnlyShowIn=Unity;
[Desktop Action Document]
Name=New File
Exec=/opt/sublime_text/sublime_text --command new_file
OnlyShowIn=Unity;
In response to the comments:
Output I get after running sudo fsck -f /
This is what appears a few seconds later each time the previous command is executed
Link for the screen that appears automatically after
The icon on the left (the one having a box) is Sublime Text 3, for which I want a default path. The right icon (one with the S) is for Sublime Text 2, which doesn't open due to expired build.
/usr/share/applications/defaults.list
file. – Terrance Aug 11 '17 at 02:55sublime text
is not showing up, that could be because you might be missing/usr/share/applications/sublime_text.desktop
file. – Terrance Aug 11 '17 at 04:27sublime_text
does it happen to appear under Other Applications instead of the Default Applications?sublime_text
may not be set as a default for anything. – Terrance Aug 12 '17 at 14:37cat /usr/share/applications/sublime_text.desktop
? – Terrance Aug 12 '17 at 21:29sudo nano /usr/share/applications/defaults.list
but before you do any editing, I recommend that you back up your file first.sudo cp /usr/share/applications/defaults.list /usr/share/applications/defaults.list.backup
– Terrance Aug 13 '17 at 03:29