Linuxtipstricks – Just another /linux/blog

November 29, 2008

How to open files with gedit using the right click menu in Ubuntu

Filed under: user tipstricks — Antonio Portuesi @ 3:55 pm
Tags: , , , , , , , ,

Many times it could be useful to open and edit a file in a straightforward way with a mouse click without any further action.

Let’s open a terminal window and type in the following command, which will create a new script file in our nautilus scripts directory

user@pc:~$ gedit ~/.gnome2/nautilus-scripts/Open\ file\ with\ gedit

Write the following script lines:

filesall=””
while [ $# -gt 0 ]
do
files=`echo “$1″ | sed ‘s/ /\?/g’`
filesall=”$files $filesall”
shift
done
gedit $filesall&

Save the script and close gedit, then execute the already known command to make the script executable:

chmod u+x ~/.gnome2/nautilus-scripts/Open\ file\ with\ gedit

Now when you right click a file in gnome environment, you should see the related context menu item “Open file with gedit”

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: