Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running Gnome. I would like to execute a shortcut key combination from the command line. For example, type a command that generates the key codes for Ctrl+Alt+Left.

Does anyone know of a way to do this?

share|improve this question
up vote 4 down vote accepted

You can use xdotool to manufacture keyboard events. See the manual and the examples for how to target a specific window.

xdotool key ctrl+alt+Left

If this is to trigger a functionality of Gnome or the window manager, there may be a separate command line tool for that. For example wmctrl gets and changes window parameters such as titles, position, etc.

Similarly, if this to trigger a functionality of a specific application, there may be a way to do this directly. Of course that entirely depends on the application.

share|improve this answer
Thanks that works! The command above should be xdotool key ctrl+alt+Left though. – austinmarton May 16 '11 at 22:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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