Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the specific method of using kill in Linux system

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you the specific use of Linux system kill, the content is concise and easy to understand, absolutely can make your eyes bright, through the detailed introduction of this article, I hope you can get something.

The conceptual kill command is used to delete a program or work in progress.

Kill can send the specified information to the program. The default information is SIGTERM (15), which terminates the specified program. If the program still cannot be terminated, you can use the SIGKILL (9) message to try to force the program to be deleted. The number of a program or work can be viewed using the ps instruction or the job instruction.

Syntax, options, and parameter syntax

Kill (option) (parameter)

Option

-a: when dealing with the current process, the corresponding relationship between the command name and the process number is not restricted;-l: if there is no option, the-l parameter will list all the information names;-p: specify the kill command to print only the process number of the relevant process, without sending any signal;-s: specify the information to be sent;-u: specify the user. 12345 parameters

Process or job identification number: specifies the process or job to delete.

Routine # lists all signal names [root@localhost local] $kill-l 1) SIGHUP 2) SIGQUIT 3) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2 13) SIGALRM 15) SIGTERM 16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP 21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ 26) SIGPROF 27) SIGWINCH 29) SIGIO 30) SIGPWR 31) SIGSYS 34) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8 43) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12 53) SIGRTMAX-11 54) SIGRTMAX- 10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7 58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2 63) SIGRTMAX-1 64) SIGRTMAX 123456789101112131415161718 only the ninth signal (SIGKILL) can terminate the process unconditionally Other signaling processes have the right to ignore them. Here are some common signals:

HUP 1 terminal disconnect INT 2 interrupt (same as Ctrl + C) QUIT 3 exit (same as Ctrl +\) TERM 15 termination (default kill) KILL 9 force termination CONT 18 continue (contrary to STOP, fg/bg command) STOP 19 pauses (same as Ctrl + Z) 1234567 first use ps search process, then kill with kill:

[root@localhost local] $ps-ef | grep vim root 3268 2884 0 16:21 pts/1 00:00:00 vim install.log root 3370 2822 0 16:21 pts/0 00:00:00 grep vim [root@localhost local] $kill-9 3268 [root@localhost local] $kill-9 3268-bash: kill: (3268)-there is no such process 123456kill-9, kill-15kill and kill-15

The system will send a SIGTERM signal to the corresponding program. When the program receives the signal, the following occurs:

The program stops immediately.

Stop when the program releases the corresponding resources

The program may still be running

After receiving the SIGTERM signal, most programs release their own resources and then stop. But there are also programs that can do other things after receiving semaphores, and these things can be configured. If the program is waiting for IO, it may not respond immediately. In other words, SIGTERM is likely to be blocked and ignored.

Kill-9

Kill-9 pid equals kill-s 9 pid, which means mandatory termination of a process as soon as possible. Most likely admin will use this command.

So kill-9 means to forcibly kill the process; compared to SIGTERM, this signal cannot be captured or ignored, and the process that receives the signal cannot perform any cleanup when it is received.

The above content is what is the specific use of Linux system kill? have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report