I ran following command on linux terminal hdparm -T -t /dev/sda. It is not giving any output and i am unable to stop this by ctrl+c and ctrl+z. How to terminate this program with out restarting system?


Both ctrl+c (SIGINT) and ctrl+z (SIGTSTP) can be handled (or ignored) by processes. If you are sure that you want to kill the process then you need to use SIGTERM (can be handled by processes) first and SIGKILL, if that doesn't work.

Open another terminal and do a ps aux|grep hdparm to get the process id and then pass that process id to kill command. If you are sure that there is only one hdparm process that is running then you can do the following as well:

# this will pass SIGTERM
ps aux | grep hdparm | awk '{print $2}' | xargs sudo kill 

# this will pass SIGKILL
ps aux | grep hdparm | awk '{print $2}' | xargs sudo kill -9
  • isn't it print $1? – eazar001 Jan 30 '14 at 7:51
  • I can't open another terminal, It's a single terminal system(Embedded system) – Chinna Jan 30 '14 at 7:53
  • @eazar001 $1 is username – Aditya Patawari Jan 30 '14 at 8:42
  • @Chinna Usually for Linux you can do ALT+CTRL+F6 to open alternate terminal. Replace F6 with anything between F2 to F7. – Aditya Patawari Jan 30 '14 at 8:42
  • @Chinna, oh right, sorry I was thinking about ps ax – eazar001 Jan 30 '14 at 9:05

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.