A Linux command (PNS) Kill command per day

Source: Internet
Author: User

The KILL command in Linux is used to terminate the operation of the specified process (terminate a process). Kill to send the specified information to the program. The preset information is sigterm (15), which terminates the specified program.

(1) Usage:

usage: kill [Options] Parameter

A parameter refers to a process or job identification number that specifies the process or job to delete.

(2) function:

function: sends the specified signal to the corresponding process. Not specifying a model will send Sigterm (15) to terminate the specified process.

If you still cannot terminate the program, you can use the Sigkill (9) information to try to force the removal of the program. The number of the program or work can be viewed using the PS or job instructions.

The root user will affect the user's process, and non-root users can only affect their own processes.

(3) option parameters:

1)-A: does not restrict the correspondence between the command name and the process number when processing the current process

2)-L < Information number: If the < information number > option is not added, the-l parameter lists all information names

3)-P: Specifies that the KILL command prints only the process number of the related process without sending any signals

4)-S < information name or number;: Specify the information to be sent


(4) Example:

1) [[email protected] ~]$ kill-l list all the signals

[email protected] ~]$ kill-L1) SIGHUP2) SIGINT3) Sigquit4) Sigill5) SIGTRAP6) SIGABRT7) Sigbus8) SIGFPE9) SIGKILLTen) SIGUSR1 One) SIGSEGV A) SIGUSR2 -) Sigpipe -) SIGALRM the) SIGTERM -) Sigstkflt -) SIGCHLD -) Sigcont +) SIGSTOP -) SIGTSTP +) Sigttin A) Sigttou at) Sigurg -) sigxcpu -) Sigxfsz -) SIGVTALRM -) sigprof -) Sigwinch in) SIGIO -) SIGPWR to) Sigsys the) sigrtmin *) sigrtmin+1    $) sigrtmin+2    Panax Notoginseng) sigrtmin+3 -) sigrtmin+4   the) sigrtmin+5    +) sigrtmin+6    A) sigrtmin+7     the) sigrtmin+8 +) sigrtmin+9   -) sigrtmin+Ten   $) sigrtmin+ One   $) sigrtmin+ A    -) sigrtmin+ - -) sigrtmin+ - the) sigrtmin+ the   -) sigrtmax- -  Wuyi) sigrtmax- -    the) sigrtmax- A -) sigrtmax- One  Wu) sigrtmax-Ten   -) sigrtmax-9    About) sigrtmax-8     $) sigrtmax-7 -) sigrtmax-6   -) sigrtmax-5    -) sigrtmax-4    A) sigrtmax-3     +) sigrtmax-2 the) sigrtmax-1   -) Sigrtmax

Only the 9th signal (SIGKILL) can terminate the process unconditionally, other signal processes have the right to ignore, the following is a common signal:

HUP      1  terminal disconnection INT      2 interrupt (with CTRL + C) quit     3 exit (with Ctrl + \) Term
      termination of KILL      9  forced termination of    CONT(in contrast to stop, fg/ BG command) STOP      Pause (with Ctrl + Z)

2) [[email protected] ~]$ kill 3429 Find and delete command

[Email protected] ~]$ Ps-ef |grep"/usr/bin/seapplet"Sunjime+3429   2990  0  -: $?xx:xx:xx/usr/bin/Seappletsunjime+12918  11465  0  A: -pts/0    xx:xx:xxgrep--color=auto/usr/bin/Seapplet[[email protected]~]$ Kill3429[[Email protected]~]$ Kill12918Bash:kill: (12918) -no that process [[email protected]~]$ Kill3429Bash:kill: (3429) -no that process [[email protected]~]$ Ps-ef |grep"/usr/bin/seapplet"Sunjime+12932  11465  0  A: -pts/0    xx:xx:xxgrep--color=auto/usr/bin/seapplet

Note that you should try not to remove the root process while testing.

3) [[email protected] ~]$ Kill-l kill Displays the value of the specified signal

[[email protected] ~]$ kill-L kill9~]$ Kill-l term

4) [[email protected] ~]$ kill-9 $ (ps-ef |grep Sunjimeng) Delete all processes for the specified user

[[email protected] ~]$ kill-u sunjimengbash:kill:u: Invalid signal declaration

the-u parameter is not available. Remove all processes for the specified user with the following command:

[[email protected] ~]$ Kill-9 $ (ps-ef |grep Sunjimeng)

5) [[email protected] ~]$ kill-9 1 kill init process

[[email protected] ~]$ Kill-91bash:kill: (1)-

Init is one of the most indispensable programs in Linux system operation. The so-called Init process, which is a user-level process initiated by the kernel. After the kernel has booted itself (already loaded into memory, started running, and has initialized all device drivers and data structures, etc.), the boot process is completed by starting a user-level program init. As a result, Init is always the first process (its process number is always 1). All other processes are descendants of the INIT process. The init process is not to be killed!

(5) Other:

Management of Linux processes:

Processes are a very important concept in a Linux system. Linux is a multitasking operating system that often runs multiple processes at the same time. We don't care how these processes are distributed or how the kernel manages the allocation of time slices, and the concern is how to control these processes so that they can serve the user well.
The Linux operating system consists of three different types of processes, each of which has its own characteristics and attributes.

1) The interactive process is a process initiated by a shell. The interactive process can be run either in the foreground or in the background.

2) The batch process and terminal are not linked, is a process sequence.

3) Monitor the process (also known as the System daemon) when the Linux system starts up and runs in the background. For example, HTTPD is the well-known Apache server monitoring process.
How the KILL command Works is:

Sends a system operation signal to the kernel of the Linux system and the process identification number of a program, and the system kernel can 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 needs to use kill to abort some processes to improve system resources. When explaining the installation and landing commands, it was mentioned that the function of multiple virtual consoles is to switch to another virtual Console to shut down the program when a program error causes the system to deadlock. The command that is used at this point is kill, because Kill is a direct call to most shell internal commands.

A Linux command (PNS) Kill command per day

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.