Write custom directory title here
a kill command
1. kill -9 process number
Force the process to stop immediately
[root@localhost ~]# kill -9 22
[root@localhost ~]#
2. kill -15 process ID
graceful shutdown process
3.kill -h
Find all process serial numbers
Two pkill command
The disadvantage of the kill method is that when we have many processes to kill, it is impossible to manually enter the process numbers one by one. pkill can kill processes according to the keywords in the process name, so that we can kill them in batches
- kill everything with the python keyword
pkill -9 python
- pkill -h
[root@localhost ~]# pkill -h
Usage:
pkill [options] <pattern>
Options:
-<sig>, --signal <sig> signal to send (either number or name)
-e, --echo display what is killed
-c, --count count of matching processes
-f, --full use full process name to match
-g, --pgroup <PGID,...> match listed process group IDs
-G, --group <GID,...> match real group IDs
-n, --newest select most recently started
-o, --oldest select least recently started
-P, --parent <PPID,...> match only child processes of the given parent
-s, --session <SID,...> match session IDs
-t, --terminal <tty,...> match by controlling terminal
-u, --euid <ID,...> match by effective IDs
-U, --uid <ID,...> match by real IDs
-x, --exact match exactly with the command name
-F, --pidfile <file> read PIDs from file
-L, --logpidfile fail if PID file is not locked
--ns <PID> match the processes that belong to the same
namespace as <pid>
--nslist <ns,...> list which namespaces will be considered for
the --ns option.
Available namespaces: ipc, mnt, net, pid, user, uts
-h, --help display this help and exit
-V, --version output version information and exit
For more details see pgrep(1).
Three process life cycle
A process is an execution process of a program. The process is introduced to realize the concurrency and real-time performance of the operating system. Generally, when you click top, you will see that this number keeps beating, indicating that the process is dynamic.
There are five main states: running state, ready state, blocking state, creation state, and end state. The
process description information is divided into two parts:
- PID: process identifier
- UID: user identifier
Generally kill is this PID, PID is an important part of PCB, and PCB as a whole