Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new here and new to Ubuntu too.

I want to set default application for sql and text files for opening with gedit.

I've already try 'Open with' with no success. I've also checked '/etc/gnome/defaults.list' and found this line 'text/x-sql=gedit.desktop'and I'm new but it seems fine. Don't know why I get this when I try to open mentioned files:

alt text

share|improve this question
up vote 1 down vote accepted

Open Nautilus (the default ubuntu file browser) then go to edit->preferences and to the behaviour tab. Then check the option:

view executables text files...
share|improve this answer

Right click on the files that you want to change the default application for (your sql and text files) and click Properties:

alt text

Navigate to the Open With tab and you can change the default application with the radio button:

alt text

share|improve this answer
+1 - That's correct. – mac Nov 28 '09 at 12:44
don't want to be impolite but I posted "I've already try 'Open with' with no success" – MHero Nov 28 '09 at 15:46
The open with from the context menu is not the same as the one in properties, which one have you tried? – John T Nov 28 '09 at 22:46

You're getting that because the file is marked as executable. The file manager is just saying "hey! do you want me to run this as a program, or open it as a text file?"

Does it open in GEdit properly if you click "Display"? If so, your file associations are set correctly. You can then get rid of this extra dialog with one of the following:

  • Follow mrucci's answer to tell Nautilus to just display executable text files instead of offering to run them. OR...

  • Remove the executable permission from the file if it doesn't need it. Run chmod -x myfile.sql on the file to remove the executable bit. Then Nautilus won't offer to run it.

The second option is not doable with chmod on FAT32 or NTFS filesystems. You'd have to mount the drives with certain mount options (eg -o noexec) to get the same effect.

Edit: There is a third option. Instead of double-clicking to auto-open the files, get into the habit of right-clicking and choosing the "Edit" option. This is what I do on Windows with .bat files, and in Thunar on Xubuntu with shellscripts (.sh) -- I don't know offhand but I'd expect the default file manager in Ubuntu can do this too. It's a good habit to get into -- even if I tweak my computer to behave "properly", someone else's system won't behave the same.

share|improve this answer

Nautilus -> Edit -> Preferences

enter image description here

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .