In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The editor will share with you what kill means. I hope you will gain a lot after reading this article. Let's discuss it together.
The kill command in Linux is used to terminate the operation of the specified process (terminate a process). Kill is a common command for process management under Linux. Kill sends a specific signal (signal) to the stroke where id is pid and does a specific action according to this signal. If it is not specified, the default is to send out the TERM signal.
Usually, you can use the Ctrl+ C key to terminate a foreground process, but for a background process, you need to use the kill command to terminate, so we need to use tools such as ps/pidof/pstree/top to get the process PID, and then use the kill command to kill the process. The kill command ends the process by sending a specified signal to the process.
1. Command format:
Kill [parameters] [process number]
2. Command function:
Sends the specified signal to the appropriate process. If you do not specify a model, SIGTERM (15) will be sent to terminate the specified process. If the program cannot be terminated, the "- KILL" parameter, which sends a signal of SIGKILL (9), will force the process to end, and the process number can be checked using the ps command or the jobs command. Root users will affect their processes, while non-root users can only affect their own processes.
3. Command parameters:
-l signal, if you do not add the numbering parameter of the signal, using the "- l" parameter will list all the signal names
-a when dealing with the current process, the correspondence between the command name and the process number is not restricted
-p specifies that the kill command only prints the process number of the relevant process and does not send any signal
-s specifies the transmission signal
-u specified user
Note:
1. The kill command can have the option of signal number or not. If there is no signal number, the kill command sends a termination signal (15), which can be captured by the process so that the process can clean up and release resources before exiting. You can also use kill to send specific signals to the process. For example:
Kill-2 123
Its effect is equivalent to pressing the Ctrl+C key when the process with PID 123 is running in the foreground. However, the average user can only use the kill command without the signal parameter or the-9 signal at most.
2. Kill can take the process ID number as a parameter. When you use kill to signal these processes, you must be the owner of these processes. If you try to undo a process that does not have permission to undo or undo a process that does not exist, you will get an error message.
3. You can signal or terminate multiple processes.
4. When kill successfully sends the signal, shell will display the termination information of the process on the screen. Sometimes this message is not displayed immediately, but only when you press the Enter key to make the shell command prompt appear again.
5. It should be noted that the signal forcibly terminates the process, which often brings some side effects, such as data loss or terminal failure to return to normal state. You must be careful when sending a signal, using the kill signal (9) only as a last resort, because the process cannot capture it first. To undo all background jobs, type kill 0. Because some commands running in the background start multiple processes, it is troublesome to track and find the PID of all the processes to be killed. At this point, it is effective to use kill 0 to terminate all processes started by the current shell.
After reading this article, I believe you have a certain understanding of what kill means. You want to know more about it. Welcome to follow the industry information channel. Thank you for your reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.