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

Suppose I boot a Linux machine without GUI. When it displays a tty login prompt, can I shutdown the machine with a keyboard sequence?

Of course I could type in my username and password and then sudo shutdown -h now; however, is it possible to shut it down before the login using a keyboard shortcut?

share|improve this question
up vote 7 down vote accepted

I've done this before with a user named "s" and no password.

IIRC you set the user's shell to /sbin/shutdown. Prolly need to add it to /etc/shells.

share|improve this answer

On most Linux systems, the Ctrl+Alt+Del key sequence action is configured in either /etc/inittab or /etc/init/control-alt-delete.conf.

Usually, this will reboot the system, but you could modify the command to halt the system instead.

In /etc/inittab:

ca::ctrlaltdel:/sbin/shutdown -t3 -h now

Or /etc/init/control-alt-delete.conf:

start on control-alt-delete    
exec /sbin/shutdown -h now "Control-Alt-Delete pressed"
share|improve this answer
Can I also use another key sequence for this? (I don't want to overwrite the reboot thing) – student Aug 9 '12 at 7:27

Here's a nice little trick that kind of surprised me (life saver if you freeze a remote system with no iLO (or KVM). The Magic SysRq key. If it is active on your system, I believe hitting ALT + SysRq + o should turn off your system. This is a hard shutdown (if I recall correctly, don't want to test it right now!) so you can press: ALT + SysRq + e (nicely kill all processes) ALT + SysRq + i Kill everything else) ALT + SysRq + s sync all file systems, ALT + SysRq + u to remount partitions as read only, then do the b or o combination (reboot or shutdown)

Anyway, I don't think this is the best way to halt your system, the other answers may be more suitable, but the above should help you out if your stuck!

share|improve this answer
Although this works, it's a little bit like stopping your car by driving it into a pile of hay. Effective, and your car will probably be okay afterward. – bahamat Aug 9 '12 at 0:58
I 100% agree with you, I tried to make that clear in my answer. If you do the key combination in the right way it is a little bit better, but yes, this is a shiny red button that does what it says and not much else. – Rqomey Aug 9 '12 at 6:49

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.