I am running following script to monitor some processes and store the output in html file. But on running, it gives the error top: failed tty get. Here is the script:

while [ $var -ge 0 ]
`echo q | htop --p=2164 | aha --black --line-fix >> htop2.html`
sleep 1

Please guide me to solve this error!

1 Answer 1


It seems to me, that you don't have htop installed. What's the output of which htop and alias? Most likely the command htop points to top on your system. Contrary to htop, top cannot be used in non-interactive environments/scripts. Try to install the 'real' htop.

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.