« Another Vista Crack | Main | How vulnerable is your operating system? »



In Web 2.0 terms a "mashup" is a website that combines content from a variety of sources in order to give users an integrated experience. You can achieve something similar using the vast variety of hidden utilities in Linux - and you don't even need to be a programmer!

A number of popular Linux applications are essentially mashups of simple command-line tools. Look behind the scenes at a program like QDVDauthor and you'll find that's it's built on a bedrock of basic but powerful command-line applications.


      A few of QDVDauthor's behind-the-GUI tools


It's this "standing on the shoulders of giants" attitude that's one of strengths of Linux. Let's try a simple example.

Ingredients
Install the following components using your distributions' usual installation method;
  • fortune
  • gmessage

Preparation
Test the components are installed and working by opening a console window and typing the component name. Entering fortune should return a random quote such as;




Test gmessage by typing gmessage hello and you should get back something like this;




Method
Simply "mash" the two programs together with this command (it should all be on one line);

fortune | gmessage -font "georgia 10"  -file -  -wrap  -center  -geometry 520x180 -title "Fortune Cookie"  -buttons Close  -default Close

When you hit <Enter> you'll get a GUI-based fortune, like this;




Advanced Mashup
To avoid having to type the command every time, save it in a text file then make the file executable with the command;

chmod +x filename

Now simply typing ./filename will execute the program.


Even More Advanced Mashup
If you use KDE, add the new program to the

/home/<your_user_name>/.kde/Autostart

folder and every time you start Linux you'll be greeted with a random addage!


Behind the Scenes
To learn more about the two commands we used, either precede them with the keyword man (for "manual") in the console window (arrow keys scroll, "q" quits), or type man:/ <program name> in Konqueror's Location bar for a nicely formatted GUI-based manual page.


<<Previous "Hidden Linux"
>> Next "Hidden Linux"



Comments

As a fan of the shell mash up method, I'm always looking for an open source tool as easy to use as the Runtime Revolution scripting tool "Transcript" (http://runrev.com) for creating the GUI interface. I am not a programmer, but can do simple shell scripts and Transcripts.

Anyone who knows of anything as easy as this tool for open source Linux can write to me at stomfisite@bigpond.com

You can do the same thing with zenity.

zenity --info --title "Fortune" --text "`fortune`"

You can embed one command in another like so:
gmessage `fortune`

I really think it is unfortunate how many programs or programmers believe this simple method is no longer useful. It seems that many popular "commandline apps" have to be converted into libraries before GUI programmers are comfortable with them. I'm sure an alpha of libfortune will hit sourceforge soon.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Subscribe
Newsletter & SubscriptionsPC World is New Zealand’s top selling computing and technology magazine.

It provides up-to-the-minute editorial, insight and buying advice for personal computing, cell phones, game consoles, digital entertainment and broadband.
SIGN UP
PCWorldUpdate
PC World's weekly round-up of tech news, gear and game reviews, software selections, and handy How Tos.