Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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
share|improve this answer
    
isn't it print $1? –  eazar001 Jan 30 at 7:51
    
I can't open another terminal, It's a single terminal system(Embedded system) –  Chinna Jan 30 at 7:53
    
@eazar001 $1 is username –  Aditya Patawari Jan 30 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 at 8:42
    
@Chinna, oh right, sorry I was thinking about ps ax –  eazar001 Jan 30 at 9:05

Your Answer

 
discard

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.