Click here for "Safe Air Conditioner Repair and Proper Freon Recovery".(Japanese Version)

Terminate the process

To terminate a running process, use the kill command.
You need to specify the PID (Process ID) as an argument, and before executing the kill command, use the ps command to check the PID of the process to be killed.

root@Lion:~# ps -a ←Displays all processes.
PID TTY TIME CMD
10086 pts/0 00:00:00 su
10087 pts/0 00:00:00 bash
10148 pts/1 00:00:00 su
10149 pts/1 00:00:00 bash
10188 pts/0 00:00:00 ps
root@Lion:~# kill 10148 ←Terminate PID10148 "su" with the kill command.
root@Lion:~# ps 10148 ←Displays the status of PID10148 "su".
PID TTY STAT TIME COMMAND
                     ←PID10148 "su" is not displayed because it has stopped

●Kill the process.
If the process cannot be killed by the normal kill command, there is a way to kill it.
The kill command has an option called signal, which allows you to control the process.
The signal number "9" is assigned as "SIGKILL", and you can kill the process by specifying this signal number or signal as an option, and specifying the PID (process ID) as an argument

root@Lion:~#ps -a ←Show all processes
PID TTY TIME CMD
10086 pts/0 00:00:00 su
10087 pts/0 00:00:00 bash
10279 pts/1 00:00:00 su
10280 pts/1 00:00:00 bash
10315 pts/1 00:00:00 top
10316 pts/0 00:00:00 ps
root@Lion:~# kill -9 10315 ←Force termination with signal number as an option

●Terminate all processes for a specific command.
If you want to use the same command to perform multiple operations and terminate them all, use the killall command.

root@Lion:~# ps -acx ←Displays the process
PID TTY STAT TIME COMMAND
1 ? Ss 0:00 init
2 ? S< 0:00 migration/0
3 ? SN 0:00 ksoftirqd/0
4 ? S< 0:00 watchdog/0<略>1818 ? S 0:00 postmaster
1840 ? Ss 0:00 atd
1847 ? S 0:00 postmaster
1848 ? S 0:00 postmaster
1849 ? S 0:00 postmaster1979 ? Ss 0:00 httpd
1980 ? S 0:00 rotatelogs
1981 ? S 0:00 rotatelogs
1982 ? S 0:00 rotatelogs
1983 ? S 0:00 rotatelogs
1984 ? S 0:00 rotatelogs
root@Lion:~# killall postmaster ←Quit postmaster
root@Lion:~# ps -acx ←Displays the process
PID TTY STAT TIME COMMAND
1 ? Ss 0:00 init
2 ? S< 0:00 migration/0
3 ? SN 0:00 ksoftirqd/0
4 ? S< 0:00 watchdog/0<略>
                             ←The postmaster is finished。
1979 ? Ss 0:00 httpd
1980 ? S 0:00 rotatelogs
1981 ? S 0:00 rotatelogs
1982 ? S 0:00 rotatelogs
1983 ? S 0:00 rotatelogs
1984 ? S 0:00 rotatelogs
Copied title and URL