Personal tools
You are here: Home / OSCAR Users Groups / The 'Ubunuts' / Tips and Tricks for Ubunuts

Tips and Tricks for Ubunuts

***PLEASE NOTE: This page is fairly dated and is not updated consistently***




Ubuntu long term support LTS versions 12.04 "Precise" vs 14.04 "Trusty"


Ubuntu has two types of update releases. "Regular" releases come up every 6 months. "Long term support" (LTS) releases are published every two years. LTS releases get 5 years of security updates following their release date.


For production use I would encourage people to stick to long term support (LTS) distribution upgrades of Ubuntu, for the sake of hassle free stability. You can play with the cutting edge "regular" 6 monthly Ubuntu distribution upgrades on your personal PC or laptop. For your production workstations you really want a boringly reliable desktop OS. You can set the update manager to ignore regular distribution upgrades and prompt you for LTS releases only.


Long term support Ubuntu version 14.04 "Trusty Thar"  has been released in April 2014. It seems to be a refinement of the existing Unity desktop rather than offer revolutionary new features. I will post a more complete review once I have adopted it completely for production use. Some specific 14.04 upgrade issues I've encountered in preliminary testing so far:
  • If you are running the 32 bit version of Ubuntu 12.04 Precise, you are better of just sticking with that for now, especially on older hardware. 12.04 still has a few years of security update support left and there is nothing wrong with it.
  • The new Citrix ICA client 13.1 plays well with 12.04 Precise 32 bit ... but not so much on Trusty 32 bit. For me the Citrix ICA is essential. This means that, on machines running 32 bit Precise, I am really be looking at a complete reformat and re-installation to the 64 bit version of Trusty instead of just a distribution upgrade via the update manager.
  • Ubuntu LTS 14.04 "Trusty" seems to be happiest in 64 bit, especially on newer hardware. I have it installed on an inexpensive new box with a Core i3 processor, an SSD and a modest 4 GB RAM, and it runs like greased lighting.
  • Furthermore the new Citrix ICA client 13.1 runs well on Trusty 64 bit. It does NOT run at all on Precise 64 bit. On machines running 64 bit Precise, then this actually is a good reason to upgrade to Trusty.
  • Autokey loses its import/export feature in the update in Trusty, but it does integrate into the system tray by default. Unfortunately the default Autokey update in the Trusty repositories is somewhat glitchy. Text phrases have missing characters and the trigger hot-string doesn't always get deleted. Very annoying in practice. Awaiting fixes in the updates. The older Autokey update on Precise is more robust. A good reason to stick to 12.04 Precise.
  • In Trusty you get to have proper File menus again in the window title bar in, where they belong, instead of the Mac style global menus in the top panel. Yay!

In summary, if you are running the 32 bit version of 12.04 LTS already, and have no good reason to upgrade, then stick with Precise for now. But if you're running 64 bit Precise, or have brand new hardware, then go ahead and upgrade to Trusty 64 bit or install it fresh.

 Back to top.


Advanced Desktop Settings Managers


If you, like me, really can't live with those Mac style window buttons on the top left there are some options:

  • A good advanced settings manger for 12.04 is Ubuntu Tweak is available for extra desktop settings. Open a terminal (CTRL+T), then copy and paste the following commands in sequence (CTRL+SHIFT+V to paste).
sudo add-apt-repository ppa:tualatrix/ppa  
sudo apt-get update 
sudo apt-get install ubuntu-tweak

 Ubuntu Tweak











  • Another advanced settings manager for 12.04 Precise is "MyUnity". You can get that from the Ubuntu Software Center 
  • In 14.04 you can get the "Unity Tweak Tool", available from the Ubuntu Software Center


Back to top.


Spice things up with Cinnamon on 14.04 LTS:


If you just can't warm up to Unity, fear not. The intrepid LinuxMint developers have followed their philosophy of "in the end the people always get what they want" and they have built a kick-ass traditional style desktop for you called Cinnamon. Even better, you can install it on top of Ubuntu 14.04! 

sudo add-apt-repository ppa:lestcape/cinnamon
sudo apt-get update && sudo apt-get install cinnamon


Cinnamon screenshot




















Or, if you're on 12.04, you could head back to the familiar GNOME classic:

sudo apt-get install gnome-panel

So, at log-in time, you get to pick the desktop you want to load by default

login screenshot



Back to top.



Two-finger scrolling:


One Mac-style feature I really do like is two-finger scrolling on the touch pad. In 12.04 with Unity that really does seem to work properly now on my Lenovo T510 laptop. What's more, the horizontal scrolling works properly too. In the past I had to install a hack to get this to work. To enable two-finger-scrolling head over to Unity's mouse and touchpad configuration utility. Press the Super Key (Windows key) and type "touchpad".


Two finger scrolling





Autokey for Unity:


Get Autokey to work properly. For the stable build, just grab it from the Ubuntu Software Center:

 Autokey install












For the bleeding edge build you can install via PPA:

sudo add-apt-repository ppa:cdekter/ppa
sudo apt-get update
sudo apt-get install autokey

Next you need to make the Autokey icon appear in the system panel at the top (Ubuntu 12.04 LTS only, this already works out of the box in Ubuntu 14.04 LTS).

gsettings set com.canonical.Unity.Panel systray-whitelist "['Autokey']" 
setsid unity


Next, restore your snippets and text macros: You can paste your existing autokey.json file with your scripts and snippets into the Autokey configuration folder of a fresh Autokey installation at ~/.config/autokey (in other words: Home Folder > Press CTRL+H to reveal hidden folders > .config > autokey). If you already see an autokey.json file there, just delete and replace with yours. I actually keep a backup copy of my Autokey json file in my OSCAR e-Docs.

If you want to save, restore and share just indivual phrases, or collections of them to other computers, rather than your entire Autokey configuration file as a whole, then that's really easy too. Autokey has an Export and Import feature for individual phrases (or groups/folders of phrases) accessible from the Autokey file menu: File > Export/Import. You can also export a phrase (or group/folder of phrases) by right clicking it in the Autokey main window. The thus exported phrase (or folder) can then be saved as a .bin file, and moved to other computers. Then use the File > Import feature in the Autokey on the other computer to add it in.  (This only works on the older version of Autokey for the older Ubuntu 12.04. Sadly the Import/Export utility was done away with in the new Autokey version for Ubuntu 14.04. To move your shortcuts in 14.04, see the paragraph above this one)


Next, set Autokey to start with your computer, under Startup Applications:

Autokey startup










Finally you need to tweak the Autokey Preferences to use X Record for key stroke monitoring:

Autokey prefs















14.04 update notes:

There are some issues with Autokey on Trusty.

  • Autokey loses its import/export feature in the update in Trusty, so you are stuck with updating the entire .json backup file in ~/config/autokey as described above.
  • The Autokey icon does integrate into the Unity system tray by default, so the above hack is not required. A welcome fix.
  • Unfortunately the default Autokey update in the Trusty repositories is somewhat glitchy. Text phrases have missing characters and the trigger hot-string doesn't always get deleted. Very annoying in practice. The reason appears to be a Python versioning issue. Awaiting fixes in the updates. The older Autokey version specific to 12.04 Precise seems to be more robust.


16.04 update notes:

Peter Hutten-Czapski has shared some useful Autokey update notes on the OSCAR email discussion list in Jan 2017:

Autokey has been ported to python 3 as  autokey-py3 and I have it working again in 64bit Mint 18.1 Serena (Ubuntu 16.04) with cinnamon UI (GTK).
The following is how to install:

# common dependencies
sudo apt-get install python3-pyinotify wmctrl xautomation imagemagick
sudo apt-get install python3-pip python3-setuptools python3-wheel

# dependencies for GTK GUI ie Cinnamon read below for qt/KDE/Unity
sudo apt-get install python3-gi gir1.2-gtk-3.0 gir1.2-gtksource-3.0 gir1.2-glib-2.0 gir1.2-notify-0.7 python3-dbus zenity

# dependencies for QT GUI, install for Ubuntu Unity KDE and other qt GUI .

apt-get install python3-pykde4 python3-pyqt4.qsci python3-dbus.mainloop.qt kde-baseapps-bin

# execute as non root
pip3 install --user python3-xlib

# install AutoKey-Py3 from PyPl
pip3 install --user autokey-py3


That might be it. Start by running

or if you want to use the qt4 version

However if you have Python 2 on your system as well as Python 3
(I do) you may get errors from version conflicts.  Those are simple to resolve.
If so you run you may need to modify the following script
and specify the versions of packages you are importing
by adding in near the top of the script the following
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Atspi', '2.0')
gi.require_version('AppIndicator3', '0.1')



Back to top


Disable the Guest Account


Ubuntu 12.04 comes with a passwordless guest account pre-installed. Some might see that as a security issue. I have found that some non tech savvy colleagues and staff will occasionally lose their bearings when they end up logging into this account by accident after restarting a workstation computer. They are then bewildered by the lack of configuration and bookmarks in the account. 

Disabling the guest account involves making some changes to a desktop configuration file under the hood. Open a terminal (CTRL + Alt + T) and open this file with the text editor (called gedit) as root for editing with the following command

For Ubuntu 12.04 LTS Precise use:
sudo gedit /etc/lightdm/lightdm.conf

For Ubuntu 14.04 LTS Trusty use:
sudo gedit /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf

the contents of the file will look like this:




Type an extra line below this as follows


So now you have this:

guest account configuration file













That's it! Click save. And when you reboot your computer the guest account login option will be gone.

Back to top



Setting up Citrix


Citrix is a widely used proprietary enterprise level virtualization interface that is a fact of life for many of us, when we remote-connect to our area hospital information systems or health authority networks from our office computers.

After a few years of fairly frustrating and buggy experiences with Citrix in Linux and Firefox, it seems that the folks at Citrix Systems Inc. have finally got their act together in Nov 2014 with their updated Citrix Receiver version 13.1 for Linux. The deb installs nicely on Ubuntu 12.04 LTS (the 32 bit version of 12.04) and Ubuntu 14.04 LTS (the 64 bit version of 14.04).

Just please do NOT try installing the Citrix Receiver 13.1 on the 64 bit version of the older Ubuntu 12.04 LTS - you will be in for a frustrating time. If you are running the 64 bit version of Ubuntu 12.04 LTS Precise, then this might be a good reason to consider upgrading your machine to 14.04 LTS Trusty 64 bit, before installing the Citrix Receiver 13.1 for 64 bit.

You can grab the install .deb packages for all Linux distributions, including for Ubuntu, from the official Citrix site here.  Pick the correct .deb file for your 32 bit or 64 bit system (and take care not to pick the Arm version by mistake). Download and save the .deb file to your downloads folder. Then click it to open with the Ubuntu Software Centre to install it.

Be sure to check the box to accept the Eula when prompted.

Citrix ICA installation













This should probably just work. If it doesn't work out of the box, then there are a few small additional tweaks you might have to make to your system to get Citrix running swiftly:


1) Once you have installed the Citrix client, you might be faced with a "you have chosen not to trust...SSL certificate" error message when trying to launch your Citrix receiver. If this is happening, then your version of Citrix is missing some of the security certificates installed in your Firefox. To fix this, you have to copy your certificate authorities' root certificates from your Firefox directory to the freshly installed Citrix client's key-store directory. This is easily done by simply copying and pasting the line below into your terminal window.
sudo cp /usr/share/ca-certificates/mozilla/* /opt/Citrix/ICAClient/keystore/cacerts


2) You might have to tell Firefox what to do with "ICA" files in order to first launch your Citrix session. If you don't do this your Citrix client will have a 30 second lag phase before launching (very frustrating), or it may not launch at all (even more frustrating). On your Ubuntu system the Citrix receiver program lives in a directory (folder) called /opt/Citrix/ICAClient and the actual "binary" (program file) is called "wfica". So, from your Firefox menu, open the Options/Preferences, then click the "Applications" tab. Now scroll down the list to find the "ICA" file type (if it doesn't appear, try clicking your Citrix web connection link first, then look again).  Now, to tell Firefox what program to open "ICA" files with, click "use other" to browse to the wfica binary on your hard drive, which you will of course find at:

File System / Opt / Citrix / ICAClient / wfica. 

Click OK and you're set. Firefox should now launch your Citrix client receiver with lightning speed the second you click your Citrix Desktop weblink.

(PS: In case you're wondering what "opt" stands for? Apparently in the old days, the "/opt" directory name was used by UNIX vendors like AT&T, Sun, DEC and 3rd-party vendors to hold "Option" packages; i.e. packages that you might have paid extra money for. This directory name was eventually grandfathered into Linux along with the rest of the alphabet soup of other weird descriptors)

That's it! You should be able to log into your health authority portal and launch the Citrix XenApp desktop interface. In case you run into further unexpected hangups, there are some (albeit now dated) Citrix installation notes described in the official Ubuntu wiki here.


 Back to top



Multiple Methods to set up the Screen Lock:


Screen locks are basic but important privacy tools in the medical office. When you step away from a given exam room workstation, you do want to protect your EMR from prying eyes and probing fingers. While the Ubuntu developers have ditched the old Gnome screen-saver in 12.04, the screen lock still exists. There are several different ways to lock the screen in Unity.


1) Set up the screen lock timeout: Head over to the dash and type lock to open the "Brightness and Lock" configuration window:

 Lock settings2

Set the screen lock to activate automatically after 5 or 10 minutes


2) Use the drop-down in menu item in the top panel to manually lock the screen:

lock dropdown



3) Use a keyboard shortcut: You can use the default keyboard shortcut to lock the screen which out of the box is CTRL+ALT+L. The problem I have with this shortcut is that you need three fingers and two hands for it. I prefer using a single key to lock the screen, since that saves me half a second every time. Luckily this is easy to set up in Unity. Head over to your dash (or hit the Super/Windows key) and type "keyboard" to open keyboard short cuts. Now navigate to the System shortcuts and click on the Lock Screen item.

 keyboard shortcuts

 Now just touch the new key you want to assign to this shortcut. I like one of the function keys for this, e.g F2 or F12. 


4) Set up a desktop or launcher icon: Many MOAs and doctors find it easier to click a desktop icon to lock the screen than having to remember a keyboard shortcut. I have previously described how to set this up in Windows XP, Windows 7, Mac OSX and Ubuntu with Gnome2 here. Setting this up in Unity is a little different, but still easily doable.

Just follow the steps below:

  •  Find a nice icon image of a lock on the Internet (or use the one below) and save it in your Pictures folder with the filename "screenlock.png"


Screenlock icon


  • Now open your text editor (look for the app. called "Gedit" in the dash).
  • Copy and paste the entire block of text below exactly as it is written, into the text editor window.
[Desktop Entry]
Comment=Lock the screen!
Exec=gnome-screensaver-command --lock
  • Replace the "yourusernamehere" with the user name of your Ubuntu system
  • Next, and this is important, save the file in your home folder with the filename Screenlock.desktop
  • Now you have to set the permissions for your screenlock script you have created and assign the icon picture. So open your file browser and navigate to the file you have so created, right click on it and select Properties:

 File properties1

And set the permissions to allow the the file to execute as a program (check the Execute box).


  • Now go back to the "Basic" Tab above and click on the empty icon picture placeholder in the left top corner:

File properties2


  • Click the square and navigate to your Pictures folder where you have previously saved the icon image for the lock and load that like so:

File properties3

Done here, click close, tricky part's over.


  • Now navigate to your home folder again in your file browser. Simply drag the Screenlock.desktop file you have created file to your Unity launcher/dock and drop it! 

 launcher screenlock

Now you can single click this to lock your screen.


  • If you want a desktop icon for the same purpose, that's easy too. Just navigate to your home folder again, and drag and drop that 'Screenlock.desktop' file you just made right onto your desktop. You will have to right click it and "allow to execute as a program" in the permissions tab again (and drag it on to the left sided launcher toolbar again too). You can now double click the desktop shortcut to lock the screen (launcher icon is single click).

 Back to top

Scheduling automatic restart of your computers:


Discussion: Office computers are often left running overnight. One of the reasons to do this, besides the time savings, is that hard-drive wear is accelerated by regular shut downs and cold boot procedures, so you should theoretically get more life out of your drives by leaving your boxes running permanently. While Linux boxes generally don't require regular rebooting (my record is 120 days between system restarts), it is a good idea to close all running applications regularly with a system restart. It is one way to make sure all users have logged out of everything on a given workstation at the end of the day.  Many people also worry about power consumption and the environment and therefore like to shut down their computers at the end of the day.

It is actually very easy to set your Ubuntu workstations to restart regularly or to shut down on a schedule.

So how do you tell your Ubuntu system to shut down? There are several terminal commands that can be used to power off your Ubuntu system.  They include shutdown, poweroff, halt and reboot. You can set a number of "flags" to fine-tune these commands. To read about them, open a terminal and type shutdown --help and find out more.  At the very least you should set the -P flag to ensure all the background process halt and the computer powers off properly.

So to shut down, halt and power off  your system from the command line with a 2 minute warning you would use: 

sudo shutdown -P +2

To reboot from the command line you could use

sudo reboot -P now

The next step is to tell your computer when to execute the shut down or reboot commands.

The built-in utility for this is called "cron" (short for "chronograph"). The Ubuntu system looks for cron instructions in a configuration text file called "crontab", located in the "etc" directory. All you do is add a line of text to the file to instruct your system to reboot itself regularly when you tell it to. The syntax for the crontab scheduling commands is:

Minute (1 to 60), Hour (0 to 23), Day of Month (1 to 31), Month (1 to 12), Day of Week (1 to 6 is Mon to Sat, Sunday is 0), User (must be "root" for this), Command. An asterisk is a placeholder. #s are comment tags.

So here is what you do: First you need to open the crontab file on your system as "root" for editing with the Ubuntu default text editor called "gedit". Open a terminal window (CTRL+ALT+T), copy the line below and paste it into the terminal (CTRL+SHIFT+V):

sudo gedit /etc/crontab

Now you can copy the lines below and paste them into a new line at the bottom into your crontab file (the one you just opened):

# Schedule a system restart every Monday morning at 04.05 am
5  4     * * 1    root    reboot -P

The first line is "commented out" with a leading #, and so will be ignored by cron. You can vary the day of the week. Monday to Saturday are numbered 1 to 6. Sundays are a 0. If you want to restart once a month, say on the 15th of the month, with 5 minutes warning before the reboot, you would use the following command instead:

# Schedule a system restart on the 15th of every month at 11.30 pm, with 5 minutes warning
30 23    15 * *    root    shutdown -h -r +5

Or how about you want to shut down your computer at the end of the work day after 5pm on weekdays, except on Wednesdays when you have evening clinic until 9 pm.

# Schedule a system shutdown every Mon, Tue, Thu and Fri evening at 5:15 pm with 5 minute warning
# And at 9:15 pm on Wednesdays
15  17     * * 1    root    shutdown -P +5
15  17     * * 2    root    shutdown -P +5
15  21     * * 3    root    shutdown -P +5
15  17     * * 4    root    shutdown -P +5
15  17     * * 5    root    shutdown -P +5


Don't forget to click save. Then close gedit.


That's it. you're done. Repeat on your next office machine. If you want to remove the command again in future you can simply open crontab again as above, delete the lines you added, and save.

Back to top

Document Actions


Download button



eForms button



Demo Button


 Customize button



Subscribe Button



Help button



 Join OCUS Button


Contact Us

Oscar Canada Users Society

#425 - 1917 West 4th Avenue

Vancouver  BC  V6J 1M7