Explain in detail how the Linux operating system kills the process

  

In today's society, computers are becoming more and more popular. We use computers, but we know how computers work? The essential part of computers is the operating system. The development of the Linux operating system is very rapid, and there is a trend to catch up with Microsoft. Here is the knowledge of the Linux operating system, so that you can learn to use the Linux operating system. Today, I will explain the killing process under the Linux operating system. I hope you will remember to kill the process under the Linux operating system. After collecting and sorting out the materials related to the killing process of the Linux operating system, I would like to recommend this article here, I hope that you will have a lot of gains after watching it.

1. kill

Role: Kill process according to process number

Usage: kill [signal code] Process ID

Example:

[root@localhost ~]# ps auxf | Grep httpd

Note: kill -9 to force termination to exit

Example [root@localhost ~]# ps aux | Grep gaim

or [root@localhost ~]# pgrep -l gaim 5031 gaim

5031 gaim

[root@localhost ~]# kill -9 5031

Special Usage:

kill -STOP [pid]

Send SIGSTOP (17,19,23) to stop a process without the Linux operating system killing the process.

kill -CONT [pid]

Send SIGCONT (19,18,25) to restart a stopped process.

kill -KILL [pid]

Sending SIGKILL (9) forces the process to stop immediately and does not perform cleanup operations.

kill -9 -1

Terminate all processes you have.

2. killall

Role: Kill all processes directly by the name of the program

Usage: killall Name of the running program

Example: Br>

[root@localhost beinan]# pgrep -l gaim 2979 gaim

[root@localhost beinan]# killall gaim

Note: This command can be forced with -9 parameters Kill Process

3. pkill

Role: Kill all processes directly by the name of the program

Usage: #pkill Name of the running program

Example:

[root@localhost beinan]# pgrep -l gaim 2979 gaim

[root@localhost beinan]# pkill gaim


4 Xkill

Function: A program that kills the desktop graphical interface.

Example of application situation: When firefox crashes and cannot exit, you can kill firefox with a click of the mouse.

When xkill runs out and the icon of the individual brain, which graphics program crashes a bit is OK.

If you want to terminate xkill, right click to cancel;

Call method:

[root@localhost ~]# xkill

◆Note:< Br>

KILLALL

NAME (name)

killall - kills processes by name on the Linux operating system

SYNOPSIS (overview)

Killall [-egiqvw] [-signal] name ...

killall -l

killall -V

DESCRIPTION (description)

killall Send a Signals to all processes running any given command. If no signal name is specified, SIGTERM. is sent.

Signals can be specified by name (eg -HUP) or by number (eg -1). Signal 0 (checking for the presence of a process) can only be specified numerically.

If the command name includes a slash (/), the process executing that particular file will be killed, regardless of the process name.

If there is no process to kill for the listed commands, killall will return a non-zero value. If at least one process is killed for each command, killall returns 0. The Killall process never kills itself (but can kill other killall processes).

OPTIONS (options)

-e For very long names, exact matching is required. If a command name is longer than 15 characters, the entire name may not be used (overflow). In this case, killall kills all processes that match the first 15 characters of the name. With the -e option, such records are ignored. If the -v option is also specified, killall prints a message for each ignored record. .

-g kills processes belonging to this process group. The kill signal is sent to each group only once, even if multiple processes are included in the same process group.

-i interactive mode, asking for confirmation before the Linux operating system kills the process.

-l lists all known signal names.

-q If there is no process to kill, no complaints will be made.

-v Reports whether the signal was successfully sent.

-V displays version information.

-w waits for all killed processes to die. Killall will check every second if any killed processes still exist, only return after all dead. Note: If the signal is ignored or not working, Or the process stays in the zombie state, and killall may wait forever.

FILES (related files)

The location of the /proc proc file system.

KNOWN bugS (known BUGS)

Killing files only works for executables that are always open at execution time, that is, mixed executables cannot pass Kill this way.

The caveat is that typing killall name may not produce the expected results on non-Linux operating systems, especially when privileged users are performing.

In the gap between scans, if the process disappears and is replaced by a new process with the same PID, killall -w is not detected.

Learn about killing processes under the Linux operating system.



Copyright © Windows knowledge All Rights Reserved