I have two machines on a local network. One is Windows 10, the other is Ubuntu 16.04.

The Linux machine is not my main computer and sits on the other side of my office, with the monitor facing me so I can play Plex or Netflix etc.

I want to know if there is any software I can use to simulate keyboard input on the Linux machine, by sending the input from the Windows machine. In this way I can browse the internet on the other computer (select a new song, or video etc), without having to physically get up and go over to the other machine.

I already have SSH set up between the two if that helps.

I was hoping for a simple command line tool that does something like:

C:/Users/Luke> sendinput "keycode here"

So that I can build my own scripts to automate things. However, I'm not against a GUI-based application either. I want to avoid the overhead of using a remote desktop viewing application.

Any advice or tools you can suggest would be great. I suppose I would need to be able to send combinations of keys, so that I have full access to the keyboard shortcuts available in whatever software I'm using on the Ubuntu machine.


You should install xdotool on ubuntu, then use it through ssh :

With ssh of cygwin :

ssh user@ /bin/dash -c  "'DISPLAY=:0 xdotool key Page_Up'"

The keystrokes are the name of keys in keysymdef.h, where you remove the leading "XK_KP_" : https://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h

You can also send a key and several modifiers : "Alt+a"

Note that ssh is "eating" one level of escaped text

You can also type text, click, move the mose, raise windows, etc...

Text example (on two lines to send a return) :

ssh user@ /bin/dash -c "'DISPLAY=:0 xdotool type \"echo hello

Here is all what you can do :

Usage: xdotool <cmd> <args>
Available commands:
  • This is pretty much what I was looking for, thank you. I will have a little tinker with xdotool – Luke Sep 25 '16 at 16:11

If you want to browse the internet on the remote machine, you probably not only want to share the keyboard, you also want to share the display so you can see what you are doing.

One way to do that is VNC, for instructions how to set this up with Windows/Ubuntu see e.g. here (or google).

If you have a ssh connection, you can automate pretty much everything on the remote machine. Besides executing programs that control other programs, you can also inject device input on various levels. One way is to write to /dev/input/event* devices directly in the correct format, see e.g. here (answers farther below, also works for keyboards or any other input device). Another way is to inject X events (both keyboard and mouse), using xdotool, xnee, xmacro or similar programs. If you want to do that, you need to set the DISPLAY in your remote shell correctly (usually to :0), and you must also make sure X authorization works (I am not sure how this is configured by default in Ubuntu, in general ~/.Xauthority must contain a valid cookie, which is issued by the display manager).

  • Thanks for your answer, but I specifically said I wanted to avoid screen sharing. Another answerer mentioned xdotool so I will definitely check that out, as well as the other two you've suggested. When I say browse internet, I meant more performing routine tasks on the internet, as opposed to freely exploring. – Luke Sep 25 '16 at 16:12
  • You said you wanted to avoid the overhead. VNC doesn't have that much overhead (it's compressed and only changes are transferred), it really doesn't tax the LAN, and it's much easier to install than setting up something with faked X input / mouse movements. But of course you should use what works best for you, so try it out. :-) For "routine tasks" I'd also consider scripting the HTTP interaction with wget/curl, or even lynx in the terminal. – dirkt Sep 25 '16 at 18:35
  • That is true - fair enough then, I will check out VNC. The main reason I asked for a 'scripty' way was to minimize the effort I have to put in for each interaction with the second computer :P but I am tempted by Synergy, and VNC now you've pointed those things out. – Luke Sep 25 '16 at 19:12

if you can see the cursor at that distance, use synergy, if not, use vnc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.