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 want to customize my run level scripts based upon a key combo pressed at boot.

How to I test for key presses as early as possible from boot? Do I need to do something special, like for example: lock the computer at run level 1 so I can prepare run level 5 scripts?

How do I go about this?

share|improve this question
Which OS/distro? – Ignacio Vazquez-Abrams Mar 22 '12 at 3:43
Linux Mint Julia 10.04 based on Ubuntu – bambuntu Mar 22 '12 at 4:24
Can't you use different grub menus? – brownian Mar 22 '12 at 10:46
Is it possible to make grub mv config files before it begins the boot process? I haven't found anything after looking. – bambuntu Mar 22 '12 at 21:49

You can use read -N 1 -t 0.1 to try and capture a keypress in your sysinit script (/etc/rc.sysinit here, dunno what it is on Mint) and switch to the appropriate runlevel based on the captured character.

share|improve this answer
How would that look in a script? I'm having trouble just getting it to work on the command line. – bambuntu Mar 27 '12 at 13:39

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.