MacOS – How to use Terminal to send keystrokes

macossshterminal

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.

Best Answer

You can use AppleScript on the Terminal:

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