How to list PPA repositories

The Y PPA Manager is a GUI that can be used to view, add or remove PPA repositories in Ubuntu. If you prefer the shell, the add-apt-repository program can be used to add or remove PPA repositories. However, there is no program that lists the PPA repositories you have added to your system.

Here is a popular shell script that lists PPA repositories:

Tried with: Ubuntu 14.04


How to use Synergy in Ubuntu


Synergy is a tool that can be used to share a keyboard and mouse across multiple computers. In this post, I will describe how I used Synergy to share a keyboard and mouse between two computers running Ubuntu.


  • Server is the computer whose keyboard and mouse you want to always use.

  • Client is the computer whose display you want to control using the server’s keyboard and mouse.

  • Make sure the server and client are connected on the same wireless network or LAN. Make sure you can ping the server from the client and the client from the server.

  • Install Synergy on both the server and the client computers:

$ sudo apt install synergy

Setup the server

  • Type Synergy in the Dash or synergy at the shell to open the GUI of Synergy.

  • Choose the Server option. Choose an encryption method from the dropdown and provide a password.

  • In the main dialog, make sure Configure interactively is chosen.

  • Click on Configure server. In the Screens and links tab, you should be able to see a blue display, which represents the server. Drag down the blue display (in the top-right corner) to a box neighboring the server display. This new display you added represents the client. My client display on my desk is to the left of my server, so I dragged the blue display and placed it to the left of the server display.

  • Double-click on the display you added. In the Screen Settings dialog, provide a Screen name to the client. This can be anything, it is just used in the grid of displays. Add an alias: you have to give the hostname or IP address of the client here.

  • Click Start to start the server. It will minimize to the system tray at the top.

Setup the client

  • Type Synergy in the Dash or synergy at the shell to open the GUI of Synergy.

  • Choose the Client option. Choose the encryption method from the dropdown and password that you had used on the server. They have to be the same!

  • In the main dialog, type in the IP address of the server and press Start. Your client is now connected to the server! 🙂


  • Remember that I have placed my client to the left of the server in the grid. So, when I want to switch to my client display, I hit the mouse to the left side of the display on my server. It will appear in the client! All the keys I type on the server keyboard now appear in the client. To switch back, hit the mouse to the right side of the client display.

Tried with: Synergy 1.4.12 and Ubuntu 14.04

How to suspend in Ubuntu

You can suspend your notebook running Ubuntu by clicking the Gear icon and choosing Suspend. If you want to suspend from the shell, then the relevant command as described here is:

dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Suspend" boolean:true

If you use this frequently, then you can turn it into a script or create a keyboard shortcut for it.

Note: The other methods suggested on the web which use the powermanagement-interface did not work for me on Ubuntu 14.04.

Brightness Indicator for Ubuntu


The brightness of notebook displays can be easily adjusted by pressing special key combinations on its keyboard. On some notebooks, these special keys may not work in Ubuntu, especially after returning from a hibernation or suspend. If you face such scenario, then you can use the Brightness Indicator application for Ubuntu.

Installing it is easy:

$ sudo add-apt-repository ppa:indicator-brightness/ppa
$ sudo apt-get update
$ sudo apt install indicator-brightness

To start it, look for Brightness indicator in the Dash. I found that on my notebook it gave 18 levels of brightness (0-17).

Tried with: Brightness Indicator 0.4 and Ubuntu 14.04

How to install CUDA 6.5 on Ubuntu 14.04

Installing CUDA is becoming increasingly easier on Ubuntu. I think I keep hitting problems because I am usually updating from an older NVIDIA graphics driver or CUDA version. NVIDIA continues to be quite bad at providing error-free upgrades. Anyway, this is what worked for me:

  • Do not try to install any of the NVIDIA drivers or CUDA packages that are in the Ubuntu repositories. I wasted a day with the errors these operations threw up!

  • Uninstall all CUDA packages and NVIDIA drivers you may have on your Ubuntu system.

  • Download the CUDA .deb package for Ubuntu 14.04 from here. For me, it was a cuda-repo-ubuntu1404_6.5-14_amd64.deb file.

  • The .deb file just adds a CUDA repository maintained by NVIDIA. Install this .deb file and update:

$ sudo gdebi cuda-repo-ubuntu1404_6.5-14_amd64.deb
$ sudo apt-get update
  • Installing CUDA now is easy as this:
$ sudo apt-get install cuda

This is a big install, it will install everything including a nvidia-340 driver that actually worked and NVIDIA NSight. After the install, reboot the computer. Your CUDA is ready for work now 🙂

Note: I tried this on two systems. On one, it installed without any problem. On the other, it gave an error of unmet dependencies. I have described here how I solved this problem.

Tried with: NVIDIA GeForce GTS 250 and NVIDIA GTX Titan

Ubuntu guest in VirtualBox loses network access after Windows host hibernate


I have a Windows host system which is running an Ubuntu guest inside VirtualBox. While the Ubuntu guest is running, I hibernate the Windows host. Later, after the Windows host is resumed, I find that network connectivity is lost in the Ubuntu guest. The LAN network interface is present and shows as connected. However, no domain name can be resolved or pinged.


I found that this bug in VirtualBox is reported here. Disconnecting the network interface and connecting back did not work. But, turning off networking and turning it back on worked!

Tried with: Ubuntu 14.04, VirtualBox 4.3.20 and Windows 7 Professional 64-bit

How to switch virtual console on Ubuntu inside VirtualBox

I sometimes run Ubuntu inside a VirtualBox virtual machine. In this Ubuntu, to switch from graphical window manager to the first virtual console, press Host + F1. By default, the Host key in VirtualBox is assigned to Right Ctrl key. So, I press Right Ctrl + F1. To get back to graphical window manager, switch to the 7th virtual console: Right Ctrl + F7.

Tried with: VirtualBox 4.3.20

How to change resolution of virtual console

On many systems, I find that the virtual console in Ubuntu is limited to 80x40. That is, it only displays 80 columns and 40 lines of text. The resolution of my display is much higher than this and I would like to render more lines and columns in the virtual consoles.

To do that:

  • Open the file /etc/default/grub in an editor:
$ sudoedit /etc/default/grub
  • We add two lines to the file. If these lines are already there, edit or comment them out. The first line provides the pixel resolution (say 1920x1200) of your display:
  • Update GRUB:
$ sudo update-grub
  • Restart Ubuntu. The virtual console should have a resolution that matches your display resolution.

Note: This also works for virtual console of Ubuntu running inside a VirtualBox virtual machine. Since the VirtualBox window can be resized (and the virtual console cannot), I provide a smaller resolution to GRUB there. For example: 1024x768.

Tried with: Ubuntu 14.04

How to set icon for application in Ubuntu

The icon set for an application is displayed when you look for it in the Dash or in the Panel when you are running it. If you find that no icon or a wrong icon is displayed for an application, that can be fixed easily.

There is a .desktop entry corresponding to every application. It will be either in ~/.local/share/applications/ or /usr/share/applications/. This is just a text file. Open it up and find the Icon entry. Set it to a path of the icon file, typically a .xpm file, you want.

Tried with: Ubuntu 14.04

How to install Eclipse Luna on Ubuntu

The Ubuntu that I am using ships with an ancient 3.x version of Eclipse. However, switching to the latest Eclipse Luna version is easy:

  • Download the latest Eclipse from here. Choose the package that matches what language you develop for. I work with C++, so I downloaded Eclipse CDT.

  • Unzip the contents. This creates an eclipse directory. I prefer to rename that to the Eclipse version. I renamed mine to eclipse-luna-4.4.1.

  • For convenience, move the directory to your ~/bin directory. I like to keep my binaries and programs in this directory.

  • You can launch Eclipse by running the eclipse binary in the installation directory.

  • If you want to install other plugins and language support for Eclipse, you can do that from Help -> Install New Software.

  • For convenience, add a Dash entry for Eclipse using Main Menu as explained here. You can set the icon for this entry to the icon.xpm file that can be found inside the Eclipse directory. However, I found that the icon was only displayed when I edited the .desktop file of the entry, as described here, to set the full path correctly, including the .xpm file extension.

  • If you would like to remove the ancient version of Eclipse installed by Ubuntu:

$ sudo apt-get remove eclipse-platform
$ sudo apt-get autoremove

Tried with: Eclipse Luna 4.4.1 and Ubuntu 14.04