In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "the use of kill and pikill and killall commands used to terminate processes in Linux". In daily operation, I believe many people have doubts about the usage of kill and pikill and killall commands used to terminate processes in Linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "kill and pikill and killall commands used to terminate processes in Linux". Next, please follow the editor to study!
Kill
Kill command: sends the specified signal to the appropriate process. An unspecified signal will send SIGTERM (15) to terminate the specified process. If the program is still unable to terminate the available "- KILL" parameter, its signal is SIGKILL (9), which will force the end of the process. Use the ps command or the jobs command to view the process number. Root users will affect their processes, while non-root users can only affect their own processes.
-l, 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
Example:
The code is as follows:
[root@redhat ~] # kill 1908 # Kill process
[root@redhat ~] # kill-KILL 1908 # forcibly kill process
[root@redhat] # kill-9 6985 # completely kill the process
[root@redhat ~] # kill-u tank # kills all processes of the specified user
Pkill
Pkill command: a combination of the ps command and the kill command to kill a specified process
-f shows the complete program
-l display source code
-n display new program
-o display old programs
-v procedures that do not meet the conditions
-x programs that meet the conditions
-p lists the process information of the process specified by the parent process for the user
-t specify all programs under the terminal
-u specify the user's program
Example:
The code is as follows:
[root@redhat ~] # pkill-t tty1 # kills all processes under Terminal 1
[root@Centos] # pkill-kill-t pts/2 # kick the user
[root@redhat] # pkill-9 6985 # completely kill the process
[root@redhat ~] # pkill-u tank # kills all processes of the specified user
[root@redhat ~] # pkill-vu root # Kills all processes that do not belong to root users
Killall
Killall-Kill the process by name [[]]
Killall [- egiqvw] [- signal] name...
Killall-l
Killall-V [[]]
DESCRIPTION (description)
Killall sends a signal to all processes that run any given command. If no signal name is specified, SIGTERM.
The signal can be specified by name (such as-HUP) or number (such as-1). Signal 0 (check whether a process exists) can only be specified digitally.
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 command, killall returns a non-zero value. If at least one process is killed for each command, killall returns 0. 0.
The killall process will never kill itself (but it can kill other killall processes). [[]]
OPTIONS (option)
-e
For very long names, an accurate match is required. If a command name is longer than 15 characters, you may not be able to use the entire name (overflow). In this case, killall kills all processes that match the first 15 characters of the name. With the-e option, such records will be ignored. If the-v option is also specified, killall prints a message for each ignored record.
-g
Kill processes that belong to this process group. Kill signals are sent only once to each group, even if there are multiple processes in the same process group.
-I
Interactively, solicit confirmation before killing the process.
-l
List all known signal names.
-Q
If there is no process to kill, there will be no complaint.
-v
Report whether the signal was sent successfully.
-V
Displays version information.
-w
Waiting for all the killing processes to die. Killall checks every second to see if any killed processes still exist and returns only when they are dead. Note: if the signal is ignored or does not work, or if the process stays in a zombie state, killall may wait forever.
Example:
The code is as follows:
[root@redhat ~] # killall sudo
End of session, end of shell. Has been killed.
At this point, the study of "the use of kill and pikill and killall commands used to terminate the process in Linux" is over. I hope I can solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.