PDA

View Full Version : [ubuntu] File extension



Niloc
September 24th, 2008, 07:42 AM
Windows recognises file by their extension and then knows which application to run for that file.
Word for '.doc' etc, how do I make Ubuntu do the same?

NoReflex
September 24th, 2008, 07:46 AM
I think it already does that. If you have OpenOffice installed it will automatically open doc, xls, ppt files.
Or you can right click a file , go to Properties -> Open With and there you can choose your applications.

Best wishes
NoReflex

Niloc
September 24th, 2008, 08:07 AM
Umm, not exactly, I am trying to run a program I wrote myself, looks like I have to modify the code to tell it to get the name of the file from the command line...

Orange_and_Green
September 24th, 2008, 08:13 AM
Hello Niloc.:)

I'm sorry, I'm afraid I didn't quite understand what your problem is. Could you please be a little more specific about what you are actually trying to do?

lisati
September 24th, 2008, 08:15 AM
I'm not sure about other versions, but 7.04 has an option where you right-click on the file, choose "open with other application", and then click on "choose custom command"

EDIT: I read somewhere in these forums that Ubuntu & Linux doesn't rely on the file-type/extension nearly as much as Windows, but relies more on permissions and content.

bab1
September 24th, 2008, 08:17 AM
Well almost. If you are running a script, then you need to make it executable with the chmod command. See
man chmod

The same with binaries, and most folk want to associate it via the GUI interface as in: right click on the file>>open with.

Some of this functionality is built in to Gnome/Nautilus. But I also have added apps (like PDF readers) and had to do the right click thing.

EDIT: The file association is a Gnome thing, not a Linux thing. Also in Perl you can specify the interpreter to use on the first line of the script.

jemate18
September 24th, 2008, 08:25 AM
if you want your script to be executable

type

chmod 750 yourscript

7 = read write execute (for user/owner)
5 = read execute (for group)
0 = none for (others)

kostkon
September 24th, 2008, 08:26 AM
Umm, not exactly, I am trying to run a program I wrote myself, looks like I have to modify the code to tell it to get the name of the file from the command line...
Right-click on the file, then from the menu select Properties, and in the Permissions tab select the Allow executing file as program to make it executable.