DormanResearch : KillCommand?

Referers: LinuxHints :: (Remote :: Orphans :: Tree )

Dorman Wiki
Dorman Lab Wiki

0Linux's Kill Command

Have you ever lost control of a command?  Maybe its gobbling up memory out of control.  Maybe its interminably slow and you realize you need to recode it and run it again, but it just won't finish.  Maybe you started it while logged onto one computer, but now realize the parameters were wrong and need to stop it from another computer.

While ctrl-c works from the command-line that you just used to issue the command, you need other options for programs started with the GUI or over another connection to the computer.

Linux's kill to the rescue.  First you need to know the pid (process id) of the command you need to stop.
ps uaxw | grep <search_term>
where you replace <search_term> with something that identifies the command, such as the command itself.  Identify the command in question in the list that is returned and make note of the number in the second column.  That is the pid.

You should first attempt to quit the application in a nice way:
kill -s SIGQUIT <pid>
where you replace <pid> with the process id (the short version: kill -3 <pid>), but  your program may be going rogue and fail to respond to your gentle request.  To unabashedly destroy the process, try
kill -s SIGKILL <pid>
or kill -9 <pid> for short.

You can also send your command other signals.  kill -s SIGSTOP <pid> to temporarily stop a process (say you need your CPU back for a minute) with kill -s SIGCONT <pid> to continue.
There is no comment on this page. [Display comments/form]