Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a link that will run a command (more specifically, open an ebook). Is there a way to do this?

share|improve this question

Generally, you can run a command with cgi.

CGI-Scripts have to be in a specific folder that has to be defined in the apache configuration. like

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

then you can just create a bash script, put it there an execute it by calling in your browser. eg. echo "Hello World" would write the output to your browser.

I'm not shure what you mean by "open an ebook", so if you give me more information about that I might be able to help you with this.

share|improve this answer
A CGI is what I was thinking of. I'm specifically trying to run "ebook-viewer %file". – Vallery Apr 17 '11 at 23:30
And what should that do? Show the ebook in your browser? show it somewhere else? just open it without showing it anywhere? I'm confused – sBlatt Apr 18 '11 at 8:22
Open it in a viewing application. – Vallery Apr 23 '11 at 15:59
If you just link it, it should get opened in a pdf viewer in your browser... If you don't have any pdf-viewer locally you might want to use a ssh x tunnel – sBlatt Apr 24 '11 at 19:13

You can have a local website (.html) with a link

<a href="http://localhost:12345"> start e-book </a>

And you need the portmapper running as a service (

sudo /etc/init.d/portmapper start

) in the background, and configure it, to start the ebook, if somebody tries to access port 12345. A bit complicated, as well as having a webserver running just for this task, but it is possible.

share|improve this answer

Another approach: Have a website with an Java applet, which starts a program. This might be not as easy, because of the sandbox and security restrictions, so you have to lern to sign applets yourself and so on.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.