Category: Guides

There are countless of tutorials online on Python programming.
But all of them seem to be concentrating on all the logic and inner workings, and as a result you have a great application…a command line application.
The problem with that is, you are more likely to stop being interested when only creating a CLI application since it doesn’t look as professional.

So, I will be diving straight in to GUI programming.
We will learn the logic as we go along, so you end up with beautiful applications.
And, I don’t expect you to have too much experience with Python or programming in general.
If you have a logic mind, then why not try it out?

We will be using PyQt.
If you don’t know what that is, it’s the combination of Python and Qt.
Qt was developed for use with the C language family, but thanks to the hard work by some expert developers, it has been ported for use with Python.
Everything that original Qt uses, PyQt can also do, and it’s only limited to your imagination.

Please note, if you aim to create games, mobile apps, or web apps, you may want to try different projects instead.
For games, try PyGame (although Python isn’t the best language for 3D games)
For mobile apps, there is a Python solution for Android, but you may want to try Kivi instead of Qt.
And for Python as webapps, try Django, it’s an amazing rapid platform for creating webapps, designed to be deployed ultra fast (I may do a tutorial of that at some point in the future).


You will need some packages on top of Python that is already pre-installed. If you aren’t using Ubuntu or a Debian based distro, consult your package manager to install these packages, although they should be available for you.

What we are going to install are these packages:

* python-qt4 – This is PyQt
* qt4-designer – A designer application which can drag-and-drop create the application
* PyCharm – Python IDE, you can use your favourite IDE instead, but PyCharm is excellent if you don’t have a favourite (yet)
* Virtualbox and Windows – Optional: Install these if you want to deploy your apps to Windows too, but don’t have a Windows system on hand.

To install, run the following command in a terminal:

sudo apt-get install python-qt4 qt4-designer

After these are installed, we need to install PyCharm, skip this step if you are going to use a different IDE:

Go to: and download the Community Edition.

Once you have downloaded it, unpack the tar ball anywhere you want, like your Home directory.
Then go into the PyCharm directory and the ‘bin’ subdirectory. In there you will find ‘’, run that and you’re ready to go.
I do recommend making a shortcut for that file so you don’t need to keep heading there just to start it. Or even better, create a .desktop file and place that in the application bar.

Once installed, if you get an error telling you that there is no Python, click on the warning and a screen will pop up, to the top right you will see a little + symbol, click on that and select Python 2.7 (default on Ubuntu) and hit Apply and Close, you are now ready.

Qt Designer

Qt Designer is a lot like Glade for anyone who ever developed in Gtk. The main difference is that Glade was extremely strict on using correct layouts.
This meant that you spent a lot of your time dividing the window into areas to place your widgets. The difference with Qt is that it’s not that strict. You can just drag and drop the different widgets wherever you want. The downside to this is that when you maximize or resize a window, the widgets just stay in place. But that’s nothing to be concerned about in the beginning.

How UIs designed in Qt Designer works is rather brilliant.
You create an applications design, and save it. This will create a .ui file. But a terminal application has been installed that will convert the ui file into a Python file. We can then make a controller Python file from where we can control all of our widgets and make the application come to life.

In the next part of the tutorial we will create a basic ‘Hello World’ application (it’s tradition). But we will ask for input and in future tutorials just build on top of it.

I hope to see you soon

A lot of entertainment news has hit Linux over the years.
From XBMCbuntu some years back to the up and coming SteamOS, Linux is the place to be.

But as I was watching boring old standard TV a few weeks back, with my laptop by my side and the Wii (yes, I like the Wii) next to the TV, I thought to myself: ‘What if I had one place that would rule all of these’.

I mean, XBMC is great for all those movies, and the Wii is great for the old reliable games, and those great titles for the PC are on steam, why don’t I combine that.
The thing is, all of these products are perfect in what they do, but they don’t do all of it (though modern consoles have tried).
But ultimately, all of these can run on Linux. This would be the glue that would bind them.
So if you are intrigued into building the perfect entertainment system, then please read on and follow my journey.
Please note though, that this isn’t a guide, more of post that should spark some inspiration (though there may be an actual guide in the future.)


So my goals were simple.
1) I should be able to watch movies
2) I should be able to watch TV Shows
3) I should be able to listen to music
4) I should be able to play console games
5) I should be able to play PC games
6) All should be integrated
7) All should be controlled with a controller (wherever possible)

The first few goals are very simple to do, but the latter (controller), that would be a real challenge, especially considering not all PC games are controller compatible, especially when things must be typed in.
The main aim with the controller would be to play Crusader Kings II with a controller (note that this game is entirely played with a keyboard and mouse for obvious reasons).

Before I begin, it’s worth noting that you need to have some hardware, but the limit is entirely up to you, just note that the better hardware, the more you gain.
In my case I had a spare all-in-one computer, since I wanted to just have that by the bed to be lazy. But, if you are going to use your widescreen TV (you want that right?) then you might opt for a fairly small and not so noisy computer. Something you can hide away behind the TV.
For what I will describe, the Raspberry Pi won’t cut it, unless you are willing to sacrifice some things.

For my Linux platform, I chose Ubuntu 13.04.
My reason is that it is out of the box compatible with most Linux applications, requires least amount of set up and I’m a big Ubuntu fan.
You could also opt for XBMCbuntu which is an Ubuntu spin-off with XBMC as it’s focus. It uses XFCE as it’s Desktop environment (which you will almost never see), so you save on that juice.

After I installed Ubuntu, my first step was to install XBMC.
If you don’t know what XBMC is, let me give it a well-deserved introduction.
XBMC stands for XBox Media Center, and started life of as that, a media center for the original Xbox.
But it soon stood all on it’s own, and is the best (in my opinion) open-source media center which sports not only those features you expect out of the box, but also add-ons created by many people to make it even more powerful.

XBMC is available for free here:

Once XBMC was installed, I first created two folders inside my Videos folder: ‘Movies’ and ‘TV Shows’.
I threw my collection of Movies into the movies folder, and TV shows into it’s corresponding folders, and each individual movie was placed in it’s own folder bearing the name of the movie. For instance ‘Zodiac.mp4’ would go into a folder called ‘Zodiac’ which was located in the Movies folder I had created earlier.
For TV Shows it was essentially the same, except, all episodes of a season were all dropped into a folder with the name of the TV show, not in separate season folders.
I will explain why in a moment.

After this, I dropped all my Music into the Music folder.
I didn’t bother with Pictures.

Once that was done, I selected Movies on the main screen and was asked for a ‘source’ for these files.
At this point, I used XBMC’s file manager to navigate to the Videos>Movies folder, and then, I selected the option that the movies were in the folders by their respective name.
I did the same for TV Shows.
After that was done, it automagically added the movies and tv shows to the list and they were now selectable through the ‘Movies’ or ‘TV Shows’ option at the home screen. And because the titles were in their right folders, it got all the information from the internet, so I was able to see a screenshot, and description of the movies in the list. NICE!

My next step was gaming – retro-style!
I wanted to be able to play all those old classics.
From the original Mario on the NES, Final Fantasy III on the SNES, and even Gran Turismo II on the original PlayStation.
For this to work, I began with the easy bit.
I created a folder in my Home folder called ‘ROMS’, and in there I created the folders ‘NES’, ‘SNES’, and ‘PS1’.

The next step was to get the emulators.
There are a lot to choose from, and to find the one best suited for you, have a look on Google, but here is what I used.
For the NES I installed FCEUX.
For the SNES I installed ZSNES.
And for the PlayStation I installed PCSX.
For more emulators, try this site:

Whichever emulator you install, please make a note of where the binary gets placed. They tend to install them in a few different places but if you are unsure, try searching for it using the search feature in Nautilus File Browser, or Google. You will need to know this later.

Ok, so next we go into XBMC and I then selected Programs, then Add-ons.
A list appeared with a few add-ons that were installed, but I selected ‘Get more…’
In that big list that appears, you will want to look for ROM Collection Browser.
Select it, and select install. That’s it.
Next time you go to Programs, it will appear in the list.
So, that’s what I did next.
The thing is, right at that moment, we have no games, and no emulators to even run them on, so it will be blank.
You probably will find that on the first run, it will ask you to create a collection. If not, press ‘c’ on your keyboard and create a new collection.
Here it will ask you some questions, most of which you can leave empty, but you will want to select the correct collection type (NES, SNES, PlayStation) and select the source.
One thing I found unclear, so I will try and save you some confusion is that the screens for the location of the emulator and the roms is identical, and it makes you think it didn’t take your first imput.
So, keep a close eye on the top when you get to this step.
If it asks for the emulator, then that location of the binary you wrote down comes in here, just browse down the location of the binary and click it.
Then when it asks for the location of the ROMS, select ~/ROMS/NES for instance. This is where our games will be.
The rest can be left as it is for now.
It will also ask you for extensions of files.
Have a look through the ROMS or copies of the games you have, and type the asterisk (*) followed by a dot (.) and finally the extenstion. Do this for both upper and lowercase. So for instance, I had two type of files, ones that ended in .bin, and those that ended in .img.
So, here I entered this: *.bin, *.BIN, *.img, *.IMG
Linux is case-sensitive, so by having added both the upper and lowercase, I stop the chances of the files not being added.
Any files inside the ROM folders that don’t have these extensions, will NOT be added to the list.
To add a game at a later date, press ‘c’ on the rom list screen and select ‘import games’, then click on the down arrow on the small box that comes up to change from ‘ALL’ to either ‘NES’, ‘SNES’, ‘PLayStation’ or whatever list you have added and whose game types you want to add.
To make a new list for a new type of console, press ‘c’ and opt for a new collection.

But, the console games aren’t entirely ready just yet.
The problem is that if you start the game now, you might find the controller not to work.
So that’s what I tackled next.

Outside of XBMC, open the emulator, and usually at the top where you have file, edit etc, you want to look for an option for joypads.
Open that up and configure your joystick.
I can’t really help you here since I don’t know which emulator you use, but it should be straight forward.
Whilst you’re there, also set the option for full-screen mode since that was my next step.

Okay, at this point, go on, test it out.
Inside XBMC, open ROM manager, press up on your keyboard to set filtering options, select a game and press enter.
If all was well, like with me, XBMC should go into windowed-mode and a full-screen game should appear.
If you want to go back, simply hit ESC and XBMC goes back to full-screen.

Next step was for all those PC games.

This is easy, install Steam if you haven’t already done so, and click on ‘Big Picture’ in the top-right hand corner.
Now Steam looks more like a media center, and next I clicked on the gear at the top to enter the settings, clicked on controller, and then the option to edit the controls.
Just click on the list and configure each button, and at the end click done.
Steam is now compatible and can be controlled with your controller.

But I still have to use my keyboard and mouse when using Crusader Kings II.
I went ahead to fix that next.
For this, I went for AntiMicro.
This application basically maps controller buttons to keyboard input, or mouse input.
I simply created a ‘Crusader Kings II’ profile, then pressed a button on my joypad to see which button that was (it lights up the button you pressed), and mapped that to keyboard keys. I did the same for the digital sticks to map mouse movements, tested, and done! Then saved the file.
Now Crusader Kings works perfectly fine (still not the same as keyboard and mouse but that’s expected).
I could do this for every game I want and fire it up when I play.

The exciting moment came when I installed AutoKey for XBMC.
With this add-on, I was able to start Steam right from XBMC, and when it closed, it would come back to XBMC. Therefore, all integrated.
The details of which I got from here: Integrating Steam and XBMC

But for some bonus points, there was one factor that would limit people, so allow me to share.
I am obliged to say that I tell you this since knowledge is power and all that.
So that out of the way, let’s add even more crunch.

What you might want to do next is add 1Channel to XBMC.
1Channel is an add-on that allows you to watch any movie, or TV Show through XBMC from the internet.
It saves space on your hard-drive, and it still has support of those descriptions and pictures.
If you want to add it, it’s probably better to follow the guide here since it has pictures and does a great job at explaining.

With all this done, I accomplished all my goals.
And since I also mapped AntiMicro for XBMC, I can stay in bed and watch a movie, play a game, listen to music and even talk to my friends without leaving my bed.

Now all I need to do is build a servant robot and I’ll never see daylight again.

I hope to find the time to actually build this again and record the steps, but this was more a sharing of my ramblings.

So, why not have a go too, and show all your friends

In part 1 we looked at how to write a bash script.
We looked at the basics including the importance of shebang, how to clear your screen, take user input and evaluate it.
We also looked at how to use IF, FOR and WHILE loops in your bash script and how you may use these loops with applications or commands.
For our example we looked at how you could use a FOR loop to batch convert wav files to mp3 files.

In this part we are going to look at how you can make your script or simple programs run by themselves at given intervals.
We will also be looking at how to make your bash script look more appealing and easier with a nice GUI using Zenity.
Kdialog is also available for KDE users, but we won’t be covering them here as Zenity is the default for Ubuntu desktops.
For information specific to Kdialog check out which has great examples of using the different options for all you KDE users.

Let’s begin!

1. Full automation with Cron

Cron is a daemon used by Linux and Unix like systems that allow programs and scripts to be ran at certain times.
The Cron daemon will run constantly to check whether any cronjobs are scheduled and then run them.
This is particularly useful when you need a certain action to be performed at a certain time.
Such actions could be scheduled updates or maintenance for system administrators.
But, they could be anything you desire.

Cron and crontabs are simple to configure and once you understand how they work, you will be ready to go in no time.

Crontabs are the programs used in order to keep cron organised.
There are two types of crontabs, one is for system functions and root privileged actions, the other is for users and does not require root.

The best way to explain crontab and cron is to use it, so let’s use it.

I have a little script which will automate the update and upgrade actions of apt-get. I want this to run at 10 minutes past midnight every day.
The script is located in a directory inside my home directory called scripts/ and the script is called

To begin, I want to edit my crontab.
I do this by opening a terminal, and typing ‘crontab -e’ without quotes.
Because this is the first time I’m using cron, it will ask me which editor I would like to use.
If you are unsure which to use and you’re a relatively new user, then you want to avoid vim (or vi) and pick nano.
Nano works most like a regular text editor in the terminal, and whilst most people will most likely shout at me for not using vim, I don’t think this is a good time to throw you in the deep end, so go ahead and select nano.

Once selected you will be presented with a file that looks like this:

# Edit this file to introduce tasks to be run by cron.
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use ‘*’ in these fields (for ‘any’).#
# Notice that tasks will be started based on the cron’s system
# daemon’s notion of time and timezones.
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# For more information see the manual pages of crontab(5) and cron(8)

# m h dom mon dow command

Wow, this might look like double Dutch to you, so let’s explain what it wants us to do.
First of all, all those lines starting with a hash (#) are comments, so they aren’t read by the system and are for your benefit.

Let me explain the structure of a cron command.
Crontab is divided in two parts. The first is the time for something to be run at, the second is what is to be run.
An example we are provided is:

 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/

Note the first 5 fields before the command ‘tar’: 0 5 * * 1
This tells us when it is to be ran.
They are ordered as follows from left to right:

Minute, Hour, Day of the Month, Month, Day of the Week

By entering a number on any of these places, you are entering a value to that time.
By entering a asterisk (*) on any of these places you are leaving that blank.
So looking at our example, it is is stating that it wants the minutes to be 00, hour to be 05, every day of every month on a Monday to be run.
This is unusual especially since the comments state every day.
Either way, it’s clear this must be run at 5am each day.
Let’s look at how I want my script to be ran.

My script must be ran at 10 minutes past midnight or 00:10 each day.
Therefore the number sequence should be: 10 0 * * *
If I only wanted it to run every 13th day of the month it would be:
10 0 13 * *
Or if I only wanted it ran the 13th of July it would be:
10 0 13 7 *

But let’s stick to my original plan of 10 past midnight each day.
Next would be to tell cron what I want to run, in this case it’s my script
This uses absolute pathnames and I also want to tell it to use bash, so I would say:
‘bash /home/me/scripts/’ (without quotes)

So my crontab should look like this:

10 0 * * * bash /home/me/scripts/

After that, I am done.
You can add more by placing each individual job on a new line.
Once I’m done, I can save the crontab using Ctrl+O and then Ctrl+X to exit.

Then to list all the jobs type ‘crontab -l’, and to remove a job ‘crontab -r’.
If you want to remove a job for a particular user use ‘crontab -r user’ (replace user with username)

See how simple that is?

2. GUI-dify Bash with Zenity

GUI’s make applications a lot more attractive, and Zenity can do that with bash scripts.
You don’t even need to install another application for it. So if your friend uses Ubuntu or another Linux distribution with Bash and is based on Gnome, then he/she could use the GUI application after you sent it.

Zenity has lots of dialogs it can present to the user, these include (from the GNOME page):
* Calendar Dialog
* Color Selection Dialog
* File Selection Dialog
* Forms Dialog
* List Dialog
* Message Dialog
* Notification Icon
* Password Dialog
* Progress Indicator
* Scale Dialog
* Text Entry Dialog
* Text Information Dialog

We are going to use some examples to create a small little application that has a few of these features.
This is the plan:

We want to create an application with bash that will ask for a password, it will then check if it’s the same as in the script, then if it is, we will ask for a favourite colour.
After that we will ask for a favourite quotation, and finally, we will let bash save them all in a nice little file and place it on the desktop.
If the password was incorrect, we will show a warning dialog box.

So let’s begin by opening Gedit.
First we use the shebang (#!/bin/bash)

Our first zenity dialog should ask for a password, so let’s begin with the following command:

password=`zenity –password`

That’s all that zenity requires for a password.
What happens here is that we created the variable password.
Inside that variable in the sideway quotes (above tab key) we put the command zenity –password.
This tells zenity we want a password dialog.
All the information that is typed in the password dialog then get’s saved in the variable password.

We can now use an IF loop to check whether the password is correct or not.
This is definitely not the way to ask for passwords but it is a good way to show how it works.

We will use the following IF loop:

if [ “$password” == “password123” ]
zenity –info –text “Correct!”
zenity –error –text “Incorrect Password”

As you can tell by now we first ask to compare the text in variable password, with ‘password123’.
If that is correct, we create an information dialog with zenity’s ‘–info’ argument and use –text to tell what we want to display.
If it is incorrect, we create an error dialog using –error and use –text to display that it is incorrect.

But we want do other things when the password is correct, so let’s remove the info dialog, and start work here.

Now let’s ask for a favourite colour.
Instead of plain and simply asking, why don’t we use a radio list, where a user can pick one.
Let’s begin.

colour=`zenity –list –radiolist –text “Please choose your favourite colour:” –hide-header –column “Choice” –column “Colour” FALSE “Red” FALSE “Blue” FALSE “Green”`

First what we did was create the variable colour.
then in the sideway quotes (is that the right name?) we told zenity we want a form of –list, and we selected the –radiolist, we want the text displayed to be “Please choose your favourite colour:”.
After this we gave –hide-header, that will ensure you don’t see the column names which we also provided. After that we gave the options available, and set them all to FALSE, meaning that none were selected by default.

Since we don’t need to do anything with this, let’s leave it just as it is for now.

Finally we want to ask for a nice quotation, for this all we want is a text entry dialog.
So we could use:

quote=`zenity –entry –text “Enter your favourite quote:”`

What we did here was select –entry for our type of dialog, and provided the text “Enter your favourite quote”, and all this is saved in the ‘quote’ variable.

Now we get to do some bash behind the scenes, and this gives me a chance to show you one more little feature of bash.

What I want to do is make a file with all this information in and place it on the desktop. But considering everyone has a different username, we need to make some small changes.
First we need to create a variable to place the current username in:


Whenever you need to put the result of a command in a variable, you need to use sideways quotes.
The whoami command usually displays the current username, but we are going to use it in a moment so we just want the current username inside the variable ‘user.
Next we are going to make another variable to save us time writing out a text file location like this:


This is more to save time but notice how we use the variable ‘$user’.
Because we saved the current username in that variable, we know it will always be correct.
Please note you would usually just use $HOME, but this was a good excuse to show you how you can really utilize variables.

The chances are, colours_and_quotes.txt does not yet exist on the desktop, and if we want to write anything to it, it will just give us errors saying it doesn’t exist.
Now would be a good time to create it, so our next command is:

touch $outputfile

Touch creates an empty file by whatever name you gave it, here we used the ‘outputfile’ variable to tell touch where we wanted it placed and by what name.
Now we are ready to send our information.

echo “Colours and Quotes” >> $outputfile
echo “—————————–” >> $outputfile
echo “Favourite colour: $colour” >> $outputfile
echo “Quote: $quote” >> $outputfile

The >> simply sends the strings to colours_and_quotes.txt.
A single > will mean it will overwrite whatever was already there, which isn’t handy if we have a few lines to send, but >> will just write one line after the other.
What we also did was use the ‘colour’ and ‘quote’ variables inside the string to be sent over. This will mean that whatever choices were made and quotes were typed in, they will be sent nicely to the text file.

If all went well, you should have a script like this:


password=`zenity –password`

if [ “$password” == “password123” ]
colour=`zenity –list –radiolist –text “Please make a selection:” –hide-header –column “Choice” –column “Colour” FALSE “Red” FALSE “Blue” FALSE “Green”`
quote=`zenity –entry –text “Enter your favourite quote:”`

touch $outputfile
echo “Colours and Quotes” > $outputfile
echo “——————————” >> $outputfile
echo “Favourite colour: $colour” >> $outputfile
echo “Quote: $quote” >> $outputfile
zenity –error –text “Incorrect Password”


If this renders wrong, please note that I put a tab (8 spaces) worth of white space inside each loop.

If you run this bash script, you will notice that at the end you have a colours_and_quotes.txt file with all the information in.

I’m sure you can find far better uses for Zenity, but I hope that you will have learned something and are able to make creative and interesting scripts.

For more information on Zenity, visit the Gnome site here:

If you have any interesting and useful applications you want to share, let me know about it.

We all know how tedious it can be to perform the same long command over and over again.
And sometimes you might not even know how to issue commands or know how they work exactly.
And when this needs to be performed the same way it might just be better if you could make a script specific to your needs.
But you may have other preferences too. Perhaps you need to perform this task at certain times, or perhaps you need to have it performed by someone else who isn’t very confident on the command line.
Luckily enough, Linux has Bash as the main scripting language built in, which is perfectly suited for just such cases.
You could write a Python script, but if it’s basic system maintenance then Bash will get the job done. And because of it’s scripting nature, it means you can write the code needed once, and perform it whenever you want, much like Batch on MS-DOS used to be (remember that?).
But Linux has more tools at your disposal which can all be combined to make your life so much easier, and I will be using all the ones that will be most useful to you.

Take for instance the Cron utility.
Cron is a utility which will run certain programs, scripts or anything for that matter, at certain intervals, in a way that is simple but very powerful.
And when you write a small script to perform a certain task and hand it over to Cron, it will carry that out at the moment you have specified. Whether once a day, once a week or even once an hour. You can forget setting your alarm to perform the task, and just let Linux deal with it.

And thanks to the great efforts of the GNOME team and KDE team, we also have great programs like Zenity and KDialog at our disposal.
These programs allow you to create a nice neat GUI for your bash script depending on which desktop you use (GNOME/Unity using Zenity, KDE using KDialog).
Unlike using Glade in combination with Python for instance, you can issue the GUI building commands directly into your script in an easy to understand way, which means you have one file which produces both the GUI and carries out the command you need.
Very handy for those who don’t feel comfortable with the command line, and if you just want a script to look nice.

In part 1 we will be looking at the absolute beginners steps.
How to write a basic bash script, then spice it up with some user input, and finally make it smart with some conditional for, while and if loops.
And at the end we will see how we can use that to automate a task. In our example we will make a 4 line script (or 1 line if you want to use semi-colons) to batch convert WAV files to MP3s.

But let’s start at the beginning, and write a couple of small bash scripts.

1. Writing a small Bash script

Bash scripts can be as complicated as you make them, but also be extremely simple.
And if you are comfortable working in the terminal, can navigate through the filesystem using the terminal, and issue commands there, you already know a lot of the basics. The simple commands ‘cd’, ‘rm’, ‘mkdir’, ‘touch’, and ‘ls’ are all bash commands, so you can use them inside your script as if you were on the command line.
But there may be some commands that you rarely use whilst working on the command line which you might require in a script.
Such examples may include ‘echo’ for displaying information, variables, and ‘read’ to take input.
As is tradition, we will begin with a simple Hello World script.
All that this script will do is clear the screen and show the text ‘Hello World’

So start by opening a text editor like Gedit and copy the following text there, once pasted, save it in your home directory under the name ‘’:


# This will display Hello World

echo “Hello World!”

Then, simply open a terminal and navigate to the directory in which you saved this script, in our case we should be in that directory already. Then issue the command (without the quotes) ‘bash’

See what happened? The screen cleared and it displayed ‘Hello World!’ after which the application quit.
So, what did we do exactly?

The first line in this script is known as the shebang (#!/bin/bash).
What this line does is tell where it can find the bash program to run this script in.
This is particularly handy when we forget to give the script a .sh ending and then it can still be run as normal.
The /bin/bash element is the location of bash on the filesystem.

The next line begins with a hash (#) which denotes a comment line.
Anything written after the hash will not be interpreted by bash and is used to leave a comment about what something does.
It’s quite irrelevant here, but in a long script that can be complicated, it is useful to explain what each part does, making it easy to make changes and simply to understand.

The first real command we have issued is the ‘clear’ command.
This command will fill the screen with enough whitespace to appear as if the screen has been ‘cleared’, this makes it much cleaner than a cluttered program.
As with all commands, you can try it out in a terminal outside of a script and it will still do the same job.

Finally the line ‘echo “Hello World!”‘ displays Hello World!
Echo is the command that simply tells the system that the following string (or variable) has to be displayed, and a string can be put in either single or double quotes.
If we replace the word World with You, and save it, it will display ‘Hello You!’.

2. Bash with interactive input and variables

The example above was simple enough, but sometimes we require some input from the user.
For that we require variables, and in the next example the ‘read’ command.
The read command will take user input and store it in a variable.
If you don’t know what that is, imagine a box. You can then take information, and store it in that box. Whenever you reference that box, you take what’s inside it out. That is how variables work, but a variable can only contain one piece of information at a time, make sure to remember that.

In the next example, we transform our Hello World script to instead say hello to whoever is using the script.


# Asking for user name

echo “What is your name? ”
read name
echo “Hello $name!”

Please note there is a space between name? and the double quotes.
If you run this script it will ask for your name and when you have given it, it will say Hello and then your name and an exclamation mark.
For instance if I give my name as Arthur, it will say ‘Hello Arthur!’.

The first line is the shebang as we previously discussed.
After the comment it will once again clear the screen.
Then it will simply display the question ‘What is your name?’, but by having a space behind it, it means that your answer won’t appear right behind the question making it look clearer.
Next we get the command ‘read name’.
What happens here is that the command read knows to take input from the user, and the ‘name’ behind it is the variable. Therefore, the user input gets stored in the variable ‘name’. We can later call upon ‘name’ to get the input.

The next line ‘echo “Hello $name!”‘ does that.
As we discussed earlier, echo displays a string on the screen, but we did something clever here. We first provided Hello as part of the string, but right behind it we put $name. Whenever you call upon a variable you have stored something in, you place a dollar sign in front of it, so the variable ‘name’ get’s called using ‘$name’, or if you used the variable ‘hello’ it would be called upon using ‘$hello’ etc.
What it therefore does is take the information stored in ‘name’ and displays it as part of the string.
Clever isn’t it?

3. Meeting conditions with IF, WHILE and FOR loops.

If you aren’t a programmer, then this bit may have seemed confusing in the past, so I will try my best at explaining what this is.
Within programming and scripting, there is a lot of loops being used.
What these do is check for a certain condition to be met.

The IF loop may for instance ask for your age, and then it checks IF a person is below 18, it will run a certain command, but IF a person is above 18 it will run a different command altogether. ELSE if a person didn’t give an age, well, then a totally different command gets issued.

The WHILE loop checks if a condition is still the same as before. So WHILE something is the same, the same command gets issued, ELSE, it may quit.
This is handy if we want to keep a program running about 5 times. So WHILE we are only on run number 4 we keep going, ELSE we stop.

The FOR loop runs similar to the WHILE loop, but a little more specific at the basic level
For instance, we can specify certain numbers we want the FOR loop to run in, it will then keep going through the loop trying to meet what we specify and stop when it’s done. Hopefully the example for this later will give some clarification to this difficult to explain loop.

Why not use these examples altogether to see how we can use them with our Hello World example script to make it more and more detailed.
This is going to look overwhelming to the previous examples, but don’t worry, all will become clear.


# A more detailed Hello World script


while [  “$end” -eq 0 ]

echo “How old are you? ”
read age

if [ “$age” -gt “17” ]
echo “What is your name? ”
read name
for i in `seq 1 $age`
echo “Hello $name, you are $1 years old!”
echo “You are too young to run this!”

First of all, this is not really the most beautiful of code and things could have been done differently, but, it illustrates the loops perfectly, whilst still being somewhat useful and easier to understand what each bit does.

The first lines are the familiar shebang, comment and clear lines.
But then we get ‘end=0’.
We use this for our example while loop, since we could use this to keep a program running (we aren’t in this example). We place the number 0 in a variable called end for later use.

Now we arrive at our first loop, the WHILE loop.
‘while [ “$end” -eq 0 ]’ looks scarily complicated, but really it isn’t.
let’s first deal with the ‘-eq’ bit.
It is simply short for ‘equal to’, and since we have place the conditions of a loop inside these brackets “[ ]”, it translates to:
While the information stored in variable ‘end’ is the same as 0.
So the script will keep checking to see if indeed ‘end’ is still a 0.
And then the next line states simply  ‘do’ to finish of our command.
So, while ‘end’ is a 0, do….

The next line is just a printed line that asks for your age.
And right below that, we are asking for user input and storing that in the variable ‘age’.
Notice how inside a loop, we leave a gap of space (just press tab), to make it easier to read.

Now we arrive at our next loop, this time the IF loop.
We are now going to see whether a condition is met or not.
‘if [ “$age” -gt “17” ]’
As before, let’s first look at -gt.
This simply means ‘greater than’, or bigger than.
As I mentioned before, we put the conditions that have to be met inside the brackets and we quote both the variable to match and what to match it to in quotes.
Then it translates to:
if the number we stored in ‘age’ is bigger than the number 17.
And the next line states ‘then’, to tell what is to happen.
So as you can see, it simply checks the number that we type in and checks to see if it is bigger than 17, if that is the case, then we go to the next bit.
But beware, greater than, does not mean including a number. For instance if you wanted to check if it was less than (smaller than) with -lt on 17, then it would not include 17, it would mean 16 and below. To include 17 you would then use, less than and equal too, in bash that would be -le (Less and Equal).

Inside that loop if the condition was met we arrive at our next part.
We first display the question of your name on the screen. Then, on the next line, we take the user input and place it in the variable ‘name’.
So far so good.
But now we arrive at our final loop, the difficult to explain FOR loop.

for i in `seq 1 $age`
Looks intimidating doesn’t it? And where did that ‘i’ come from.
Well it’s actually fairly straight forward.
The ‘i’ is a temporary variable we are going to use (could be anything but ‘i’ tends to be the traditional variable to use).
Then the seq is short for sequence. What For loops do is run through a sequence until the conditions no longer apply.
After having stated ‘seq’ we give our starting point at which to loop, in our case: 1.
After that we give our end number at which to stop, in our case we gave the variable ‘age’.
All this inside quotes (the ones on the key above the tab key, not regular quotes).
Let me replace the variable so you can see what it does.
Say we gave our age as 19.
What it then really says is ‘for i in `seq 1 19`’
And if we translate that, it means, that it will run in a sequence from 1 to 19, every time using the variable ‘i’, which becomes clear in a moment.
After the do command, you see ‘echo “Hello $name, you are $i years old!”‘

As you can see, it displays ‘Hello’ and the name given, after that it displays ‘you are … years old!’.
Remember how we gave the variable ‘i’ to the for loop?
What it now does is it begins with giving variable ‘i’ the value of 1 (since that’s where we said we want our sequence to begin), it then runs through this loop and then displays ‘you are 1 years old!’, then it goes back to the top and reaches number 2 in the sequence, and changes variable ‘i’ to 2, and then displays ‘you are 2 years old!’.
This will happen all the way until it reaches the last number in the sequence. In our case it’s in a variable, so whatever age we gave in. After that it stops. Therefore, you will see a fair few lines with ‘You are … years old!’ each line 1 year up.
We also added ‘end=1’.
Remember right at the beginning that we gave ‘end’ the value of 0? And how we told the while loop to keep running this entire program as long as ‘end’ was equal to 0?
Well, at this point the variable is changed to 1, so the while loop condition is no longer met, and the program is allowed to quit.

Since the For loop is done, we have to close it off, we do this by using the ‘done’ command.
Now you see ‘else’, if you look carefully at the structure, you will notice it is in the same line vertically as the beginning of our IF loop, this means that the ELSE condition is part of the IF loop.
Inside of ‘else’ we simply display that you are too young to run this.
We knew this because we told the IF loop to check if the variable ‘age’ was greater than 17.
And the ELSE statement acts when that condition isn’t met (in this case when ‘age’ is smaller than or equal to 17).
After that, it changes the ‘end’ variable to a 1 to allow the while loop to finish and stop our program.

If you took out all the ‘end=1’ parts, then the program would keep running.
At the end of the IF loop, we put ‘fi’ to end the loop, and at the end of the while loop, we use ‘done’ to close it off.

4. Using loops with commands

But this is all about automating tasks, not hello worlds.
We can use these loops to automate a task however, in little ingenious ways.
For instance, have you ever had a .wav file that you wanted to change to an MP3 file?
That’s all fair and well, but what if you had 100’s of them?
The annoying bit isn’t only the manual conversion, but you have stupid new names like 1.mp3, 2.mp3 3.mp3 etc.
What if you wanted to batch convert the whole lot, and keep their original names while you were at it?
Well, why not use the FOR loop for this?!

Say you have the command  ffmpeg -b 192k -i abc.wav abc.mp3 which converts the abc.wav to abc.mp3.
Handy right?
We can make it a batch conversion command using a for loop.

for i in *.wav
ffmpeg -b 192k -i “$i” “${i%.wav}.mp3”

Instead of giving a number for a sequence in a for loop, what we did is say *.wav.
The asterisk (*) means anything or all. So in this case it means any file ending in .wav.
So what we are doing is we are telling the script to run through all files that end in .wav.
The first file it encounters automatically gets placed in variable ‘i’.
Then it runs the ffmpeg command on it, and if you replace all the variables ‘i’ with what is contained in it, you will get something like the following, if your file was abc.wav:

ffmpeg -b 192k -i abc.wav abc.mp3

You might be confused by the whole ‘${i%.wav}.mp3’ thing.
This bit basically removes the .wav bit and replaces it with .mp3, so the name stays in tact but instead it’s an mp3 file.
You could also put it all in one line. Just place a semi-colon (;) behind the end of every command.
This one would become: for i in *.wav; do; ffmpeg -b 192k -i “$i” “${i%.wav}.mp3”; done

Try some out for yourself

Why not try some out for yourself
In part 2 we will be looking at introducing Cron.
We will try and automate our scripts even further by letting the system take care of them. Write it once, never need to run it again by hand will be the motto.

I hope you have enjoyed this tutorial, and keep an eye out on part 2

Ubuntu and Optimum Graphics

There is a common myth that’s still very present, and it’s about Optimum and Linux.

For those who don’t know what Optimum is, it’s a system (laptop) that has two graphics cards.
The integrated Intel graphics card for every day use, and a Nvidia graphics card for all your gaming needs.

The way that it works is that you would be able to switch between graphics cards almost like a switch, depending on when you need it.

However, there appears to be a belief that the Optimum driver support under Linux is either hit-or-miss or very unstable.
This is truly a myth.
Another myth surrounding it, is that it is difficult to set up and a hassle. Once again, another myth.

I will walk you through the steps of installing the support for Optimum using Bumblebee, and I will also show some extra steps to make the experience as easy as possible and customized in order to provide the best experience possible.

Feel free to skip the steps you do not require.

The steps will be:
1) Add the Bumblebee repository and install the Bumblebee drivers
2) Install the Bumblebee indicator for a simple GUI interface
3) Create a .desktop file for PlayOnLinux to choose your graphics card
4) Edit Steam for Optimum support

1.a. Adding the repositories

This is an easy step, and requires terminal use, but don’t worry, it’s foolproof.Open a terminal and type the following command:

sudo add-apt-repository ppa:bumblebee/stable

Once you hit enter, it will ask you to hit Enter once more, once you do so, a couple of lines appear and the repository has been added.

We will also want to add a repository for the latest Nvidia drivers with the following command:

sudo add-apt-repository ppa:ubuntu-x-swat/x-updates

But now you need to update your software database. This is done with the following command:

sudo apt-get update


1.b. Installing Bumblebee

First we will need some additional packages, these can be installed with:

sudo apt-get install linux-source linux-headers-generic

To install the drivers, you only require one line in the terminal:

sudo apt-get install bumblebee primus bumblebee-nvidia

This line when entered, most likely want your permission to install, so if it asks, simply hit ‘y’ and it will install.
That’s it!

2. Adding the Bumblebee indicator

At this point you can already use your Nvidia card using either the command ‘optirun <app name>’ or ‘primusrun <app name>’. But, this isn’t the most efficient or user friendly way to use it. So we can use the Bumblebee indicator.
This indicator sits in the notification tray and allows you to add applications, so that you can start applications through it. It will also notify you when the Nvidia graphics card is in use. So it’s a very useful app to have. So enough about what it is and what it does, let’s get installing it.

This step is a little more advanced, but shouldn’t pose any issues if you follow this guide.

The first thing we need is git, this is where the application is hosted.
Open the terminal and type:

sudo apt-get install git

After this is installed we need to make a folder called git and navigate to it.
We do this with the commands:

mkdir git

cd git/

Once you have created this, we need to pull the application ready to be installed, we can do this with the command:

git clone

After that we can navigate into the directory with the command:

cd bumblebee-ui

And to install the application simply type:

sudo ./INSTALL

A lot of things may happen, and if you don’t see any errors, then simply log out and back in (or restart) and you will see a little bee icon in your tray, feel free to play around with it. By clicking on it and then ‘Configure Apps’ you can tick the installed applications you want to run through your Nvidia card and then clicking on the icon again and then ‘Preferred Apps’ you can run it.

3. Adding a .desktop file for PlayOnLinux

You might be wondering why I added this additional step.
I use PlayOnLinux, and some of the applications I use are not intensive graphically, whilst others are.
I don’t want to sacrifice power by running an application using Nvidia card when it’s unnecessary and visa versa.
Then there is the additional annoyance that you get when you have to configure every single application to use the Nvidia driver and sometimes it just doesn’t work well. So in an effort to get rid of this annoyance, I came up with a simple solution.

If you use PlayOnLinux, you can just copy the text below and change the reference ‘<USER>’ to your username.

I also created a hidden folder in my home folder called .Games to place an icon of PlayOnLinux in, just to make it more appealing.
You can do the same and look for an icon of PlayOnLinux on Google Images for example and placing that in a similar folder.
If you create a .Games folder and use an image named logo.png in there, then you can use the ‘Icon’ part of the following text and just change <USER> to your username, if you have it in another folder, use another name for the image, or don’t use an icon, then make sure you change that line accordingly.

Firstly, open a text editor such as Gedit and paste the following text in there:

[Desktop Entry]
Comment=Play Windows games on Linux

[IntelRun Shortcut Group]
Name=Run on Intel

[NvidiaRun Shortcut Group]
Name=Run on NVidia
Exec=optirun playonlinux

Then save this textfile as PlayOnLinux.desktop and place it in the .local/share/applications folder in your home directory (note: .local is a hidden folder as the dot indicates, in order to view it press Cntrl+H ).

Once that is done, navigate to .local/share/applications  (in your home folder) with the file browser, and drag and drop PlayOnLinux.desktop to the side panel.
If all went well, you should now see an icon on the panel, and when you right-click on it, you will be presented with the options ‘Run on Intel’ and ‘Run on Nvidia’.
Choosing Intel will run PlayOnLinux through the integrated card, and choosing Nvidia will run PlayOnLinux through Nvidia.
Consequently, the games that you run through PlayOnLinux will also run in the same mode as you started PlayOnLinux in.
For instance, if you selected ‘Run on Nvidia’ and once on PlayOnLinux play Oblivion, then Oblivion will be run with your Nvidia card.
And if you have the Bumblebee indicator installed, it will notify you that it is started with Bumblebee.

4. Running Steam games with Bumblebee

This is really simple to do, but is annoying since you have to configure this for each game, unless you use the same approach as with PlayOnLinux and run Steam with Bumblebee. But assuming you want to only run games through Bumblebee. Let’s see how that is done.

First open Steam and select your Library.
Right-Click on a game you want to use with Nvidia and select ‘Properties’.
Then click on ‘Set Launch Options’ and in the text box paste the following line exactly as it is:

vblank_mode=0 optirun -b primus %command%

That’s it, you can close the windows and when you run the game, it will run with Bumblebee.

I hope that this is has provided you everything to get the most out of, and make it relatively simple to switch between graphic cards.

If you are getting a little bored by the ‘Steam posts’ lately, please do let me know, but I thought it would be nice to be ahead of the game.

If you are one of those people who is super-excited about Steam natively on Linux, then you will soon run out of excitement when you realise that most games, and the really popular ones, are not yet available for us Linux users.
So how cool would it be if we could play Windows games through Steam on Linux so you have all those features of Steam whilst playing those games, and having your Steam friends know that you are playing those games?

As you can imagine, we will be using Wine for this to be possible, and in particular: PlayOnLinux, when you are done you should have something like this:

As the screenshot above shows, here I have Europa Universalis III inside the native Steam client. This obviously isn’t an official Steam game, therefore it is limited. However, when you play the game, you still have the Steam features

And when you are playing this Wine game, it does show up in chat exactly what you are playing:

Note how it states that I am playing the non-Steam game Europa Universalis III.

Funny enough, this isn’t difficult to do, and has many advantages.
Rather than having your games scattered around, you can have all your games, Linux or Windows inside one client: Steam.
So let’s look how I did it.

For ease and convenience, I used PlayOnLinux.
This is a pretty Wine GUI and allows you to make seperate Wine bottles and install games from a list or manually with minimal effort. For more information on PlayOnLinux, have a look at another post as I won’t be covering that here.

If you have PlayOnLinux installed and have some games running on it, you are ready to go. I do recommend having a few games (or just one) installed through PlayOnLinux before you begin.

Begin by creating a directory in your home folder which I am calling ‘.POLGames’.
I am using the .(dot) in front of the folder name to keep it hidden and keep my home directory clean.

Next, you will want to keep that folder open, then fire up PlayOnLinux.
Select the game you want to add to Steam and click on ‘Create a shortcut’ on the right-hand panel.
This should have created a shortcut to that game on your Desktop.

Right-click on the shortcut and click on ‘Properties’ and then you should see ‘Command’ under the name, and description. This should be filled in by a line typically starting with ‘/usr/share/playonlinux –run …’.
Select that entire line and copy it (Ctrl+C) as we will need this later.
Then close that window and drag the shortcut to the directory we created, in my example ‘.POLGames’.

Now open Steam for Linux.

Click on ‘Library’ and at the bottom click on ‘+ ADD A GAME’ and then ‘Add a Non-Steam Game’.

You should have a window open which takes a moment to populate.
When it is done, look through this list and see if the game is listed and add it, if it is not listed, don’t worry, we will add it manually.

Click on ‘Browse’ and go to ‘/home/USERNAME/.POLGames/’ (if you used .POLGames, otherwise whatever you called the directory). You can move up a directory by clicking on the icon of a folder and an up arrow at the top.

You should find all the .desktop files of games you have added there earlier from the created shortcuts you placed in there earlier.

Select the game you want to add and click ‘Open’.

If all went well, then you should have it at the bottom of your games list.
If the name is incorrect, you can change it in a minute.

Next we need to change the run command since it will just open PlayOnLinux if you click ‘Play’.

Now right-click the game you added to the list in Steam and select ‘Properties’.
This should open the ‘shortcut’ menu.

Here you should see a button named ‘CHOOSE ICON…’, the name of the game, ‘Target’, ‘Start In…’ and a button named ‘CHANGE…’.
If the name of the game was incorrect, change it in the text-box underneath ‘CHOOSE ICON…’.
Now then, underneath target you need to remove what is in that box and replace it with the line we copied earlier from the PlayOnLinux shortcut command.
We can leave the rest alone, just click ‘CLOSE’.

Now you can click ‘PLAY’ and you are able to play the Windows game inside Steam.

Have fun!

I am slightly behind with this news article, but if you weren’t yet aware let me explain about the news.

As you might be aware, Valve has begun their work on a Linux client for the popular game service Steam.
And not too long ago they were looking for experienced Linux users for their closed beta.
I signed up like thousands of others but did not make the cut.

The beta started a few days ago and some users on Reddit have already breached it.

This breach allows non-beta accounts to access the Steam client and use it.
BUT, before you get too excited, Valve already discovered this breach and it’s not much use anymore.
You are able to use this client to run games you already have installed on your system using the ‘Add non-Steam Games’ feature. But games on Steam for Linux are unavailable for those who do not have a non-beta account.

The question has become whether this will have repercussions or not.
Will this breach make Valve think again about Linux and it’s users?
My personal opinion is that this will make no change to their idea of Linux users at all.
The reason for this is that anyone who signed up for the beta will have been asked how many years experience they have with Linux, and those with longer experience had more of a chance to gain access. Also, those attending Ubuntu Developer Summit gained automatic entry.
Therefore, for Valve to be annoyed by this seems illogical, after all, any Linux user with more than 7 years Linux experience will be a hacker.

Then the question becomes, was this a publicity stunt?
Yes, this question has also come up, and I think it has already been answered.
I don’t think it is, purely because they closed this loophole very quickly and if it was a publicity stunt, they would have allowed it to be used, or at least by a few more people.

But, regardless of the limited functionality for non-beta users, let’s have a look at what to expect and what is already available.

Finally we can have our own Steam icon on the panel as expected, which integrates perfectly with Ubuntu, allowing you to access your friends list, store, library and more by a right-click on the icon. Unfortunately I couldn’t show you the quick-list, but here you see the icon in full glory on the bar.

"The Steam Icon"

Once you click it however, you get an error because you are not a beta user (at the bottom you will find the work around) as you can see below.

After you run the command from the terminal to gain access you will find it in it’s full beauty.
This is exactly the same as you can see in the Windows client.

What you will notice is in the top right corner you see ‘Big Picture’.
This allows you to switch to a full-screen mode which is similar to what you expect from a console version or a media center like XBMC or the like.
It was a little laggy at loading (Intel integrated graphics) but once you get to the main screen it was very responsive and fluid.
This feature is absolutely gorgeous and I can imagine many will use it a lot.

As part of the work around it was initially possible to install games like Team Fortress 2 using a terminal command. However, whilst it begins installing, it will stop with an error about the servers being busy.
I suspect that this is a polite way of Valve telling the hackers they won’t get very far.










All in all, this is not going to allow you to download and install Games.
However, it is a nice glimpse into what we can expect from Valve very soon.
And if (like me) you want your games that you already own organised neatly, then you will find some use in Steam now, as you are able to play games you have added manually.

To install Steam Beta, get access, and attempt to install TF2 yourself:

Firstly open up a terminal and you can install the client by using these commands:


This will download the client, to install:

sudo dpkg -i steam.deb && sudo apt-get install -f

If you are using 64-bit Ubuntu, you will need the extra 32bit library and run the following command:

sudo apt-get install libjpeg-turbo8:i386 libcurl3-gnutls:i386 libogg0:i386 libpixman-1-0:i386 libsdl1.2debian:i386 libtheora0:i386 libvorbis0a:i386 libvorbisenc2:i386 libvorbisfile3:i386 libasound2:i386 libc6:i386 libgcc1:i386 libstdc++6:i386 libx11-6:i386 libxau6:i386 libxcb1:i386 libxdmcp6:i386

Once you have done that, you can run steam by using this command (please do not run it from the icon as this will not work):

steam steam://open/games

This will allow you to enter Steam without errors about being a non-beta user.

If you want to have a go at installing TF2 or at least trying, the command is as followed and needs to once again be entered in a terminal:

steam -dev steam://install/440

This resulted in a failed install for me, but feel free to try yourself.

Since there seems to be some misinformation, misunderstanding and general confusion about viruses on Linux, I hope to be able to explain a few things.

As we all know, a virus is a program that has malicious intent.
There are many forms in which they appear, but there is not reason for me to explain the ins and outs of virii, so let’s crack on with the issue at hand.

I will be looking at the difference between the Windows OS and Linux OS (specifically Ubuntu). I would use Mac OSX too, but eventhough it’s a Unix operating system, I have not used it enough to be able to speak about it confidently.

Let me start off by dispelling one common held belief.

It’s often said that the reason for a lack in viruses on Linux is because such a small amount of users worldwide use Linux, it is better for virus programmers to target Windows than it is Linux.

Every part of this statement is false.
If you are a clever virus programmer, you are better off targeting Linux than you would be Windows.
Windows is a Desktop operating system which could render home users and businesses useless.
Whilst this seems a great idea, it’s not very clever.
Since the majority of worldwide servers run a Linux distrobution, targeting them would be far more interesting, since they are connected more vitally to others than any home computer or single business.
For instance, if you were to target a virus to the server of a major internet company, instead of it irritating the people in head office, you are now shutting the company down.

But Linux isn’t just servers and a few home computers. There is the Android OS, many car computers, robots and even space systems are running Linux.
In fact, I actually believe more people on this planet use Linux than any other OS.
Actually, if you are anti-Linux, I think you most likely are using Linux many times a day.

So with that myth dealt with let’s actually look at the real issue.

Let us look at the system structure on a Windows OS and it’s security, or lack of.
And I’m not just talking about anti-virus here by the way.

At it’s core, the file structure begins at the hard drive on which the OS is installed, this is usually C:
For comparison purposes, we will call this point ‘root’. Since everything starts from this point, root is possibly the best word for it.

From root, you typically find (on a 32bit system) the Windows folder, Program Files folder, Users folder, and perhaps some others.

When you enter the Windows folder, and head on over to the System32 folder, you will find a lot of files.
These files are the core of a Windows system.
If you have ever encountered the annoying Blue Screen of Death or unrecoverable system crashes, the most likely place where things have gone wrong is in this folder.

Now simply open a file which is vital to the system with Notepad, and change something and save it, or delete a few files (by the way this is for illustrative purposes, DO NOT DO THIS, I will not be held responsible) and congratulations, you have just broken Windows.
Simple isn’t it?

Let me just say before I get told how wrong I am, that I am building this on Windows XP and perhaps Vista. I have never used Windows 7, and Vista was extremely brief, so I expect things to have changed.

What this comes down to is simple security.

It’s all well having anti-viruses but if your system is so easy to tamper with, it’s like lying awake at night with a baseball bat in case burglars come in whilst leaving your front door open. You are more or less prolonging the inevitable.

Now let us look at Linux.

Linux begins at it’s root, actually known as root.
Root in Linux is not given a letter like in Windows, rather it’s symbol is a forward slash (/).
From this point, all the file structure starts.
Linux does not like to throw every important file in one general folder.
Every type of folder holds it’s specific type of file.
For instance, all the configuration files are held in /etc, and /usr hold application files.

However, it gets a little more complicated than that.

For those folders you always need an administration password.

There is also a folder in the root directory called /home.
Within this folder you will find folders named after the different users of the computer.
Going into these folders will hold all the personal files such as pictures, music, videos, etc etc.
But typically, hidden away are separate copies of configuration files and applications.
These do not require a password.

This serves multiple purposes.
Firstly, if for an application such as Emesene (a Linux Windows Live Messenger application) you have individual configuration files within your own home folder, it means that each person has their own login name shown, and other users aren’t shown.
Secondly, if something does not require the use of important administrative programs, then it would make more sense to have it in the home folder.

So let’s now look at how viruses can be made and how easy with each OS.
Technically speaking, if I wanted to just cause damage and nothing else, all I would need to do for Windows is to create an application that deletes files in the Windows folder.
Then I would have achieved my goal and usually without problems in security.

With Linux it’s a different story.
If I wanted to create damage, I would first have to think of where the damage has to be done.
If I simply wanted to damage users files, then I could write a script that deletes things in the users directory because that requires no administrator passwords.
However, it would make no change to the OS which would still run just as well.

If I wanted to damage the system and render it useless, then I rely on skill and the user being somewhat naive.

Firstly, I could write a script that would empty the harddrive.
Funnily, if you are running Linux, whilst still using it, you could empty the harddrive, although most Linux distributions no longer allow you to run the script needed, which for obvious reasons I’m not going to supply.

The issue with this is no matter whether you create a cunning app, or a script, it requires administration rights. Which in debian based systems is sudo and more server style OS’s as su.
They will then be asked for their password.

Now if someone is naive and hasn’t checked the code and just runs it, of course it will do damage.
But usually someone will have checked the code and warned others.
If they aren’t naive they won’t run it.

Also an added bonus that Linux has is their ideals for OpenSource.
Most software is written using scripts (like Bash) or languages (like Python) which most times have the sourcecode easily obtainable and open to scrutiny.
Meaning that the chances in passing a virus in even complex applications is very very small.

But you might also be wondering how anti-viruses work.
Even though that is slightly irrelevant to this article, I do want to explain.

Anti-virus software is not all magical with it’s ability to know what a program does and therefore stop it in it’s track.
In fact, it works totally different than that.

If you have anti-virus software you will have noticed that you hear that a database has been updated, or is not up to date.
What happens is the people who work for companies like Norton, and AVG, find out there is a new virus on the loose.
They scrutinize a copy of this virus and how it reacts.
Then they record it’s patterns in a database which is sent to you.
If you catch that virus it checks the database to see if it matches any in the database and then stops it.
So this also means that if you are the first person to get the newest most evil virus ever, your in trouble since it isn’t in the database.

Now there are many anti-virus software on the market for Windows, but only a couple for Linux.
Most of the basic reasons why I have outlined.

But there is also the point of arrival for the different OS’s.

Windows users are used to getting their software from a website, where, if we are honest, anybody could have created it for whatever purpose and even under different guises.

Linux doesn’t approach software this way.
Linux uses package management. Ubuntu uses the Ubuntu Software Centre, and Debian uses Synaptic for example.
These package managers are thoroughly checked so that you know that whatever software you download is safe.
Sometimes you download software from websites but this isn’t always encouraged, and usually someone warns you if it’s not safe.

Now these are not all the reasons for the reason why Linux viruses are rare, for they do exist.
But they are the most basic reasons.

My advice:
If you cannot find a piece of software you are after in the software centre or Synaptic, and have to download from a website.
First ensure it is safe by seeing what others have to say about it.
If someone promotes a script (as I have for Paltalk and Lotro) first see what others have said about it, and then if you have not enough information, read through the code, or have someone else read through it, to ensure that it’s safe to use.
And obviously, if a script or program asks you for your password, don’t just jump in and give it, find out why it needs it.

A few years ago a picture was leaked from a Microsoft course for businesses selling computers.
The picture showed a slideshow regarding Linux. It gave mythological ‘facts’ about the limitations of Linux compared to Windows.
Mentions of no MP3 player compatibility, no DVD support and Word documents support, there was also the lack of games.

Nowadays we know that MP3 players work perfect and DVD support is most often out of the box.
But gaming seems to still be a reason for many people to not use Linux.

I want to introduce those new to Linux to the choices they have for gaming on Linux.
It’s actually a lot easier than you may think.

So, let’s see what options we have!

Native Linux Games

By native we mean games that were made for Linux.
These usually come in the form of .deb files (or .rpm if your using a RedHat based system) a .bin file or a .run file.
The good side to this is that there are no difficult steps to follow, and you know they run optimally on Linux.

The downside to native Linux games are…well…the real popular games are mostly absent in this list.
But really, that depends on what type of person you are.
I have to admit, I play games neither for their graphics, nor their popularity.
If a game has a great story, or is just great fun to play, then I’m very interested.

If you are a person who absolutely loves first person shooters. Then Linux is heaven for you. As the amount of FPS in the Software Center and websites for Linux is rediculous.
But, if you are a person who wants to keep up with the latest trends in games, then you will find Linux somewhat lacking.
But, there are other options for you.


Wine stands for Wine Is Not an Emulator.
And what it does not do (since so many people seem to think this), is to emulate Windows a bit like VirtualBox or VMWare.
What it does is convert the signals it gets from programs or games to native Linux equivalents.
This makes sense, since many report that many programs and games designed for Windows run better through Wine. This would not happen if it was an emulator since it would require the Windows system resources which run on top of the Linux ones, making it do more than Windows alone, and therefore run slower.

However, Wine runs Windows apps on Linux, that’s the point.
But before you get all excited, this does not mean that whatever you throw at it will work.
There are a few programs and apps that simply do not work.
Luckily for you, Wine has come a long way since it’s beginnings and there is a far greater chance in something working, than not working.

The upside to Wine is that it’s free, works for games and programs alike and has a fantastic community behind it.
They have an AppDB(Database) which means you can search for a program or game on there to see if it works well or not.

The downside to Wine is that it’s not for the faint hearted.
Whilst it’s not rocket science and if your quite comfortable on Linux it’s not too difficult to use, for new beginners it’s quite difficult.
Also, it’s fairly bare boned.
Especially with games you will find that you need to install extra components such as DirectX in order to get games to work.

Crossover Games (Non-free)

If you are willing to pay money to get games to work with minimal trouble and some commercial support for when it’s not working, then maybe Crossover Games is something worth considering.
Crossover Games is an application built on top of Wine.
It allows you to select a game from a list within the application (not all games are listed) and follow three small steps and it will set up the game with the correct version of Wine, all necessary drivers or additional programs it needs, and without needing to grab headache tablets your game will be set up ready for you to play.
You can also visit their site (all links at the bottom of this post) and if you find a game you want to install, there is a possibility you only have to click on a button on the page and it will install it for you. It couldn’t be easier.

The upside to Crossover Games is the ease with which you can get games to install and work. You don’t need to worry about using Wine, installing extra components since it’s all done for you. You also get great support, and because you pay, it’s like any commercial support, it is answered as quickly as possible.

The downside to Crossover Games is that it costs money. Although there is a demo available, the fact that it’s based on Wine (which is free) and you basically pay to ease it’s use, makes you want to think again. Don’t get me wrong, support is good, and I have used it happily for sometime, but if you already paid for the game, you might not want to pay for having to play it.


PlayOnLinux is like Crossover Games in it’s aim, except it is built by a community rather than a company, it doesn’t have commercial support and it’s free.
PlayOnLinux is also built on top of Wine, and makes installing games a breeze.
You select a game from the list, and it will install the correct version of Wine, necessary drivers and components and makes it ready for you so you can just play the game rather than trying to get it to work.
Sometimes you will have a game that isn’t listed, and if you find it works on Wine through their AppDB, you also have the option to install it manually.

The upside of PlayOnLinux is the ease with which you can install games, and it’s great community support. The list of games is big and always growing with the latest games on the list. I also find an upside that you can remove the shortcuts on your Desktop if you like since it makes a nice list of the games you have installed available when you open PlayOnLinux, and you can just click on one and then click on Play to start the game.

The downside to PlayOnLinux is it’s support. Some installers are not always clear or sometimes outdated. However 99% of the times it works perfectly.

My recommended choice:

Since native Linux games are obviously the best choice, I’m going to exclude that from my choice as it would always be number one.

Out of the remaining three my choice would be:


I have found myself using PlayOnLinux for all Windows games that work.
If a game is not in the list, I install it using PlayOnLinux manually just for organisation.
When a game is listed it’s a case of Next Next Next Finish and you can’t argue with that.
Whether you play World of Warcraft, Lord of the Rings Online, Call of Duty series, Fifa or anything else, you will find PlayOnLinux perfect!

Regarding non-listed games:
If you have a game and it’s not in the list, don’t dispair. Go to the Wine AppDB in the link at the bottom and check whether it works, and on which version of Wine.
Then using PlayOnLinux in the games list at the bottom click on the link for non-listed programs and set up a new prefix (a prefix prevents one messed up app from messing up others), select the version of Wine to use, what extra components you need and then install the game.

Please note that the version of PlayOnLinux in the Ubuntu Software Center is almost always out of date, so please use the link at the bottom to use the newest version.


Native Linux Games


Crossover Games


I have received a lot of comments about people who were not able to install Lotro on their machine.

In order to make this as easy as possible, I have written a small script which will automate the entire process for you.
Please note that you are pretty much a guinea pig since I already had LotRO installed, I wasn’t able to completely test the script. I have ran it without errors, but it was more overwriting my existing install.

Please feel free to read through the script before you use it (can’t be too safe) but please don’t complain about how ugly the code is, it hurts my feelings.

Also, I am not able fix problems with this script, it just automates the install, but I will add some common problems at the bottom of this page, if you encounter any problems, they may help out.
If you have a problem I haven’t covered, then feel free to comment.

How to use the script

First download the FULL installer from .

Then download the my script from and place it in the SAME directory as the Lotro Windows installer.
The Lotro Windows installer must be unzipped and then make sure the script is in the same directory as the unzipped files.

Open a terminal and navigate to the directory in which these files are placed (E.g. if the unzipped files and the script is placed in a LOTRO folder inside the Downloads folder you would type ‘cd ~/Downloads/LOTRO’)
Then type ‘sh’ and hit enter, then follow the instructions.

Possible issues

If you get the error ‘hardware texture compression support was not detected’, then this is a graphics card issue. This can be fixed by opening a terminal and typing ‘sudo apt-get install driconf’. After that, open driconf, click on the Image Quality tab and change the ‘Enable S3TC texture…’ setting to ‘Yes’.
After that it should load.

If you have a black screen but hear the music, or when you get to the character screen it all goes black:
Then your graphics settings are set too high.
This can be resolved like this (Although tedious):
First open Regedit by typing ‘regedit’ in a terminal and hitting enter.
Then go to HKEY_CURRENT_USER > Software  > Wine > Direct3D (if it doesn’t exist, create it).
Create or change the key ‘DirectDrawRenderer’ to ‘gdi’.
Then go to a folder called ‘The Lord of the Rings Online’ inside your home folder. Not the one inside the .wine folder.
If you are unable to locate the folder, then search your home folder for a file named ‘UserPreferences.ini’.
Once you have located this, open it with your favourite text editor.
At the bottom of this file are the graphics options. Find all the options there that are set to ‘High’ and change them to ‘Low’.
Also change options like bloom and lighting to ‘Off’.
Save the file and try and login to LotRO using pyLotro and see if you still have this issue.

I hope this helps some people, and if it did, enjoy the game!