With the Linux operating system, it is inevitable to encounter some software "jam" problem, then need to use Linux under the powerful KILL command to end the related process. This is extremely easy under the Linux system, you only need to kill xxx, where xxx represents the process PID number associated with this software operation.
First, we need to use Linux under another command PS to find the process-related PID number: PS aux | grep Program_filter_word
1 PS A shows all the programs under the current terminal, including other user's programs.
2) ps-a Show All Programs.
3 PS C listing the program, display the actual instruction name of each program, and does not include the path, parameters or the indication of resident service.
4) Ps-e The effect of this parameter is the same as the specified "A" parameter.
5 PS e When the program is listed, display the environment variables used by each program.
6) PS F Displays the tree structure with ASCII characters, and expresses the relationship between the programs.
7) ps-h display tree structure, indicating the relationship between programs.
8 Ps-n shows all the programs except the ones that perform the PS instruction terminal.
9 PS s adopts program signal format to display program status.
PS S lists the program, including the interrupted subroutine data.
ps-t< Terminal number > Specify the terminal number, and list the status of the program belonging to the terminal.
PS U displays program status in a user-oriented format.
PS x shows all programs and is not differentiated by terminals.
The most commonly used method is PS aux, which then filters through the grep command to find a specific process and then operates on a particular process.
Second, end the process with the KILL command: Kill XXX
The KILL command is used to abort a process.
Kill [S Signal |-P] [-a] pid ...
-S: Specifies the signal to send.
-P: Analog send signal.
-L: Specifies the name list of the signal.
PID: The ID number of the process to abort.
Signal: Indicates a signal.
Processes are a very important concept in Linux systems. Linux is a multitasking operating system that often runs multiple processes at the same time. We don't care how these processes are allocated, or how the kernel manages the allocation of time slices, and how they are concerned with controlling these processes so that they can serve users well.
The Linux operating system consists of three different types of processes, each with its own characteristics and attributes. The interaction process is a process initiated by a shell. The interaction process can be run either in the foreground or in the background. The batch process is not connected to the terminal and is a sequence of processes. The monitoring process (also known as the System daemon) is the process that starts when the Linux system starts and runs in the background. For example, HTTPD is the well-known Apache server monitoring process.
The KILL command works by sending a system action signal to the kernel of the Linux system and a process identification number for a program, and the system kernel can then operate on the process specified by the process identification number. For example, in the top command, we see that the system runs many processes, and sometimes it is necessary to abort certain processes using kill to improve system resources. When explaining the installation and landing commands, it was mentioned that the function of multiple virtual consoles of a system is to switch to other virtual consoles to work off the program when a program fails to cause the system to deadlock. The command used at this point is kill, because Kill is a direct call to most shell internal commands.
5) Application Example
(1) forcibly terminated (often used to kill) a process with a process identification number of 324:
(2) Unlock the Linux system deadlock
In Linux, there are times when a program crashes and is in a deadlock state. You don't have to restart your computer at this time, just abort (or close) the problematic program. When the Kill is in the X-window interface, the main program (except the crashed program) is normally activated. A terminal is opened at this time, where the problematic program is stopped. For example, if the Mozilla browser program is deadlocked, you can use the KILL command to abort all programs that contain Mozolla browsers. First use the PS command to find the program's PID, and then use the KILL command to stop this program:
where xxx is the process identification number of the program that contains the Mozolla browser.
(3) Reclaim memory with command
We know that memory is very important to the system, and reclaim memory can improve system resources. The KILL command can suspend some "deviant" programs in a timely manner or for a long time without a corresponding program. For example, using the top command to discover a useless (Zombie) process, you can use the following command:
where xxx is a useless process identification number.
Then use the following command:
You will see an increase in available memory capacity.
(4) Killall command
Linux also provides a killall command that can directly use the process name instead of the process identification number, for example:
# killall-hup inetd