Create Custom Keyboard Shortcuts

Want to set up custom keyboard shortcuts in Ubuntu? xbindkeys let’s you do just that. It’s easy to set up, and should work with any window manager.

Install xbindkeys and its graphical configuration tool using this command:

sudo apt-get install xbindkeys xbindkeys-config

Alternatively, you can click the links below if you are using Ubuntu 7.10 or later:

There’s a bug in xbindkeys that will cause it to crash because there’s no default configuration file. You can work around this problem by running the following command which creates the required file:

touch ~/.xbindkeysrc

Get started creating shortcuts by running xbindkeys-config in a terminal.

xbindkeys-config window

Here’s how to create a new keyboard shortcut:

  1. Click New from the bottom row of buttons.
  2. Type in a name for the shortcut. This is just an identifier and can be anything you like.
  3. Click the Get Key button, wait for the capture window to open, and press the shortcut keys you want to use. Be careful that your shortcut does not conflict with any existing ones in GNOME, Metacity, or Compiz. I’ve found Super(windows)+Letter shortcuts work well as long as you watch out for the few that Compiz uses.
  4. Type the command you want to run with the shortcut in to the Action box. Your command can be anything that runs in the terminal. Here are two examples you may find useful: firefox (opens Firefox to a website), gedit myfile.txt (opens a text file). Click the Run Action button to test it out.
  5. Click Apply to enable your new shortcuts.
  6. Before you exit xbindkeys-config, click Save & Apply & Exit to save your settings to the default configuration file and exit.

You need to set up xbindkeys to start when you log in. In GNOME, you can add xbindkeys to the list of startup programs in System->Preferences->Sessions.

The first shortcut I set up was Super-P to open my text file of blog post ideas. What keyboard shortcuts do you find useful?

Archived Comments


You should take a look at keytouch too, which has many presets for keyboards with extra keys. Installable with your favorite package manager.


Thanks for this article…I think this would be a great way to preserve keyboard shortcuts across window managers. One key combo I can’t live without is Alt+Enter to bring up run dialog or GnomeDo. Another that I like is Ctrl+Alt+n, to open my notes.txt file.

Francois Rigaut


If you use compiz, you can also define shortcuts from the General ccsm menu.


if you like using the keyboard for navigation type things you should try Gnome Do. it’s great


thanks for this, I have a Microsoft keyboard with special extra keys and finally I can make use of them!
Very neat.


Thanks. Bookmarked. :)


Thanks, dude. I was trying to figure a way to create a shortcut for Gnome-do.

Now, Basically, I can create a shortcut for whatever program.

Karin Dalziel

Thanks for this. I used it with this command:

scrot ‘%Y-%m-%d–%s_$wx$h_scrot.png’ -e ‘mv $f ~/screenshots/’

to take a screenshot and save it directly to a folder rather than bringing up a dialog when I press “Print Screen”. I first changed the old print screen binding to control+print screen. :)

Respond via email