Is it possible to create a keyboard shortcut that will run:

shutdown -h now

When I press Ctrl + 9, for example.

  • Any particular OS? Nov 6, 2011 at 2:49
  • Debian sid, running XFCE. I would prefer to have the shortcut run regardless of whether or not X / XFCE has been started though (I sometimes use the machine as a server). Which is why I thought inittab might work.
    – Mike
    Nov 6, 2011 at 2:53
  • 1
    Bear in mind that bindings listed in inittab can be overridden by your WM/DE/OS. If you want it to be truly global, you will need to also configure your environment to allow it to act as so.
    – Chris Down
    Nov 6, 2011 at 12:31

2 Answers 2


Something pretty similar does probably already work: see SysRq key sequences (see also the Linux kernel documentation). Some variant of REISUB, maybe REISUO (O for poweroff instead of B for reboot) could be what you want.
Not as quick and versatile as a way of binding Ctrl+9 to any command, but a possibility.

  • This is neat, up-voted you for it.
    – Mike
    Nov 6, 2011 at 21:57

You can define two such shortcuts on the Linux console. Pressing Ctrl+Alt+Del sends the SIGINT signal to init; this triggers the ctrlaltdel action in inittab. This action usually triggers /sbin/shutdown -t1 -a -r now (reboot now); change that to /sbin/shutdown -t1 -a -h now if you want to halt instead. The other shortcut is the KeyboardSignal console key (bound to Alt+Up by default, but you can change that in your console keymap), which triggers the kbrequest action in inittab.

Note that these bindings may not be triggered while you're in X. Under X, you can use your window manager's key binding features, or another program such as xbindkeys. Note that under X, you don't get a free pass to run commands as root; if you want to trigger a reboot without entering a password, you'll need a NOPASSWD entry in sudoers.

(Aside: Ctrl+9 looks awfully easy to type by mistake. It's also a keyboard shortcut in several applications. Pick something rarer and with two modifiers!)

Your Answer

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

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