How to use Terminal to send keystrokes?

Is there a way for Terminal to simulate pressing multiple keys at once? For example, Shift+Ctrl+R?

I am sshing into OS X from a Windows client (PuTTY) and am wondering if I need to configure the client or is there a native way for OS X to emulate these commands on the receiving end.


Solution 1:

You can use AppleScript on the Terminal:

osascript -e 'tell application "System Events" to keystroke "r" using {control down, shift down}'

Solution 2:

the cliclick shell tool is pretty awesome. sends keystrokes, clicks, all sorts of stuff

https://github.com/BlueM/cliclick