Wednesday, April 7, 2010

ubuntu: starting your favourite word program from the run dialog

This can in fact be done on most linux distros. Most machines will come with a default office suite called Open Office. But starting up this word processor program isn't as simple as it is on windows where you can simply type in a command in the run dialog to start the program!!!

But fortunately, this is something a little shell scripting, and symbolic linking can fix.

I simply create a shell script (writer.sh) to do the necessary starting up of my word processor program. The command to startup Open Office's Word Processor program we've to simply type:
ooffice -writer

You could append the above command with a word document you already have on your file system; so it will open the document as the application loads.

Below is how the script looks like:


#writer.sh
if [ $1 ]; then
ooffice -writer $1
else
ooffice -writer
fi


You should probably save this file in your /usr/bin path. Now give necessary execute permissions for the above script file.
chmod +x writer.sh

Now if you type writer.sh in shell, your application should show up. Now simply create a symbolic link to it and store it in the same path above.
ln -s writer.sh writer

Now if you simply type writer in shell or in the run dialog your word processor program should startup.

Happy ubuntuing...

Note: most of the above command should be run as root
Post a Comment