On Linux Mint, I would like to bind a shortcut key to run a command*.

I have already achieved this using the GUI, but I need a way to define this keyboard shortcut from the command-line, without GUI interaction**.

The keybinding should work identical to the one created through the GUI and work anywhere. In other words: not a bash binding, which would only work when sent to that terminal window.

Further explanation:
* The command it will run is shutter -s. It lets me take a screenshot of an area of the screen, but that isn't relevant to the scope of this question.
** Why I want to do this: I run Mint on many machines/VMs, and need to be able to provision new ones quickly. To achieve this, I've scripted the installation of everything I need to do dev work.

  • 1
    I assume your shell is bash: do you use vi-mode or emacs-mode? You'll want to read about bash's bind command under Builtin commands, particularly the -x option – glenn jackman Oct 9 '18 at 18:31
  • @glennjackman I think my question was a bit ambiguous so I've re-worded it for clarity. – Eric Seastrand Oct 10 '18 at 11:59
  • I have same goal. I found in comment here community.linuxmint.com/tutorial/view/1171 commands for Mint Cinnamon (different from Ubuntu standard), they make bindings appear in GUI but shortcuts not working... – Alexei Martianov Jan 16 at 4:59

Your Answer

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

Browse other questions tagged or ask your own question.