Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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'm writing a bash script to gather some informations about disks and then start the 'nmon' tool to monitor only those specific disks.

I start the nmon tool out of the bash script (with -g). To get the correct view within the tool one need to press the g key on the keyboard.

Is there any way to get that keypress automatically triggered out of the bash script?

Thanks a lot!

share|improve this question

Try this:

echo -n "g" | nmon

For more infomation:

Or use expect (man expect comes with examples).

share|improve this answer

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.