Synergy is the application that I use to share a single keyboard and Mouse between multiple computers. Its just like dual display setup, i.e. you move your mouse over to one edge of the screen and it goes to other computer. I have been using Synergy to share USB keyboad and USB mouse plugged into one laptop with other, both running Ubuntu. You can also share between different OS like Windows and Mac.
To share the keyboard and mouse between two Ubuntu laptops follow the steps below.
First decide which laptop will be the server and the host. The server's keyboard and mouse will be used to control both the server's and client's operation. After deciding go to the server compuetr and install synergy. You can click here to install Synergy in Ubuntu.
Create a file called .synergy.conf in your home folder with following text.
right = Lenovo
left = HP
This file has three sections.
The last section is the aliases section. Here you can define aliases to the hostname or IP address of your computer so that you can address them easily in other sections. If you don't define them here, you have to use the hostname or IP address in other sections instead.
The first section is the screens, just list the aliases of computer here.
The second section is the important section. Here you have to define the physical location of the computers. Actually you define what edge will jump the mouse to other computer. So, here I've first defined for HP. To the right of HP I've Lenovo, i.e. when I move mouse over to right edge it will go to Lenovo. Similarly I've defined settings for Lenovo saying to the left of Lenovo is HP. When I move mouse over the left edge of Lenovo, the mouse will move to HP.
Now I can run synergy server by running the command synergys from terminal. Run this command in the server, for me its HP.
Now time for the client setup.
Make the same file in same location in your client computer. Run the synergy client command synergyc <server_hostname>
from terminal. HP-540-laptop.local is my server, so I'd run
Synergy setup is complete. Now you should be able to control both the computer with single keyboard and mouse.