0

I work on a linux machine connected to a cluster. If I do top on a terminal, I see many (~200) sleeping processes. Probably they were caused by me by inappropriately Ctrl+C-ing those processes.

How do I know which sleeping jobs are safe to kill?

EDIT: I can check the processes by ps -e S. The problem is, probably, that I do not understand the output. For example:

24086 pts/0    Ss+  11971:50 -tcsh
24084 ?        S      0:00 (sd-pam)
22183 ?        Sl    10:08 /usr/bin/gedit --gapplication-service
4790 ?        S      0:00 [kworker/u16:2]
1043 tty7     Ssl+  91:14 /usr/sbin/brld --nodaemon

And many others. How do I know that by killing them I do not cause any trouble to my machine or to other's logged-in jobs?

0

Instead of looking at top to see your sleeping processes, you might be better off doing a ps -ef | grep <process name> instead of trying to get them from top. this way you will get the pid you need to kill the process with. a lot of the sleeping processes in top are normally system processes.

example:

[thebtm@localhost thebtm]# ps -ef | grep httpd
root      1257     1  0 Mar28 ?        00:00:51 /usr/sbin/httpd -DFOREGROUND
root      2920 10825  0 08:35 pts/3    00:00:00 grep --color=auto httpd
apache   16936  1257  0 Apr10 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   16937  1257  0 Apr10 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   16939  1257  0 Apr10 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   16940  1257  0 Apr10 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   20857  1257  0 Apr10 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   20858  1257  0 Apr10 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   20859  1257  0 Apr10 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   20860  1257  0 Apr10 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   21040  1257  0 Apr10 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   21041  1257  0 Apr10 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
[thebtm@localhost thebtm]# kill 16936
3
  • What is the difference between the command that you suggest, and ps -e S? In my case, the former returns only the process just called, while the second returns a long list of processes.
    – Py-ser
    Apr 13 '17 at 7:38
  • That i something i would have to look into, I am just used to using the ps -ef command to view all active processes on the system.
    – thebtm
    Apr 13 '17 at 15:38
  • please see the edit of my question.
    – Py-ser
    Apr 18 '17 at 8:20

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.