You may want to use Templates
directory (or how is called in your language) from your home directory in this sense. Files from this folder will appear in the New Document
menu. So, add the files with the extension what you want in this folder and you can create them after files with the same extension from the right click menu:
Moreover, if you add some predefined text in these files from Templates
folder, the new files which you will create them from the right click menu will contain that text.
See also: What is the "Templates" folder in the home directory for?
Here is a small Nautilus script which gives you a "Use a custom command" dialogue box on Nautilus.
The Script
Save the following script as Open with custom command
in the following directory
~/.local/share/nautilus/scripts/
(Ubuntu 13.04 or above)
~/.gnome2/nautilus-scripts/
(Ubuntu 12.10 and below)
#!/bin/bash
var=$(zenity --entry \
--title="Add Application" \
--text="Use a custom command" \
--width="320")
if [ $? -eq 0 ] && [ "$var" ]; then
$var "$1"
else
exit 0
fi
- Give the script execution permission. It is important, otherwise no change will take place. You can use in terminal,
chmod +x ~/.local/share/nautilus/scripts/Open\ with\ custom\ command
Or you can do it from GUI. Right click on the script, then go to Properties >> Permissions and check the box corresponds to Execute to give the script execution permission.
How it looks like
After that when you right click on a file you could see an option Scripts followed by another option under script Open with custom command.
When you select the option Open with custom command, you will get a dialogue box like,
You can write a command in the box to open the file.
Usage
You can open any file by entering corresponding application's command only in the dialogue box.
For example you can open a .txt
file using gedit
or a .pdf
file writing evince
in the dialogue box.
Some Other Usage
Open file as root:
If you want to open a file as root, just use gksudo
before your command. To open a .txt
file as root you can use in the dialogue box,
gksudo gedit
Opening an unknown file:
If you are not sure which application to use to open an unknown file, you can use in the dialogue box,
xdg-open
Opening a file with a Terminal Application:
If you want to open a text file using vi
, you can use in the dialogue box,
gnome-terminal -x vi
Note:
To use gksudo
you need to have gksu
installed. In Ubuntu 13.04 onwards it is not install by default. You can install it using,
sudo apt-get install gksu
Best Answer
Refresh button for Nautilus on right-click menu
You will need a to download
xdotool
andnautilus-actions
:Open
nautilus-actions
and do the following:Display item in location context menu
/usr/bin/xdotool
, Parameters tokey F5
.nautilus -q