Few days back, I came across this nice idea on ubuntu forums. If you want to print a file, why do have to open it and then print? What if you wanted to print multiple files? Its the small things like these that reminds you the usefulness of scripting. So how do I do it?

cupsdoprint -P PrinterName file1 file2 file3

cupsdoprint is a command line tool to print via CUPS. So we have our little script around CUPS to print. How do we add it to the mouse context menu? As simple as creating an executable script and dropping into the nautilus script folder. Nautilus passes the context information to the script as variables.

The script file would look like this:

#!/bin/bsh
files=$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
cupsdoprint -P MyPrinter $files
exit 0

Name the script “Print”, make it an executable and drop it to your ~/.gnome2/nautilus-scripts folder and happy printing!