Saturday, May 9, 2009
11:59 AM

Open a file from the command line using its default application

Windows users are familiar with the concept of file association. When you double click a file (say, cisco.doc), Windows examines the file name extension (doc), and opens the file using the default program associated with that extension(Office).

Linux users can open files in a similar way in their X Window graphical user interface. But, if you want to open the file from the command-line, you need to type out at least the program name, oowriter, or do you?
$ oowriter cisco.doc 


If GNOME is your window manager, use the gnome-open command as follow:
$ gnome-open cisco.doc 


oowriter is automatically started up to open cisco.doc, if oowriter is indeed associated with the .doc file name extension.

For KDE users, use kde-open instead.

Alternatively, you can run the window-manager-neutral program called xdg-open. xdg-open is part of the xdg-utils package.

$ xdg-open cisco.doc



StumbleUpon Toolbar

0 comments:

Post a Comment