How to "kill" unwanted processes in Linux

Source: Internet
Author: User
Tags pkill
Article Title: How to "kill" unwanted processes in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

The Linux operating system has developed very rapidly and is catching up with Microsoft. When using a Linux system, some system processes are not required at ordinary times. In this case, you need to disable them. After collecting and sorting out the relevant Linux operating system killing process materials, I would like to recommend this article to you. I hope you will see a lot of GAINS.

1. kill

Purpose: kill a process based on the process number.

Usage: kill [signal code] process ID

Example:

1. [root @ localhost ~] # Ps auxf | grep httpd

Note: kill-9 to force termination and exit

Example

1. [root @ localhost ~] # Ps aux | grep gaim

Or

1. [root @ localhost ~] # Pgrep-l gaim 5031 gaim

2.5031 gaim

3. [root @ localhost ~] # Kill-9 5031

Special usage:

1. kill-STOP [pid]

Send SIGSTOP (17,19, 23) to stop a process, instead of killing the process in Linux.

1. kill-CONT [pid]

Send SIGCONT (, 25) to start a stopped process again.

1. kill-KILL [pid]

Send SIGKILL (9) to force the process to stop immediately without cleaning.

1. kill-9-1

Terminate all processes you have.

2. killall

Purpose: directly kill all processes by program name

Usage: name of the program that is running killall

Example:

1. [root @ localhost beinan] # pgrep-l gaim 2979 gaim

2. [root @ localhost beinan] # killall gaim

Note: This command can use the-9 parameter to force the process to be killed.

3. pkill

Purpose: directly kill all processes by program name

Usage: # Name of the running program

Example:

1. [root @ localhost beinan] # pgrep-l gaim 2979 gaim

2. [root @ localhost beinan] # pkill gaim

4. xkill

Purpose: Kill the desktop graphic interface program.

Application Scenario example: When firefox crashes and cannot exit, you can click the mouse to kill firefox.

When xkill is running and the icon of the personal brain is displayed, it will be okay if any graphics program crashes.

If you want to terminate xkill, right-click to cancel it;

Call method:

1. [root @ localhost ~] # Xkill

◆ Note:

KILLALL

NAME)

Killall-Kill processes by name in Linux

SYNOPSIS (Overview)

Killall [-egiqvw] [-signal] name...

Killall-l

Killall-V

DESCRIPTION)

Killall sends a signal to all processes that run any specified command. If no signal name is specified, it sends SIGTERM ..

The signal can be specified by name (such as-HUP) or number (such as-1). The signal 0 (check whether the process exists) can only be specified by number.

If the command name includes a slash (/), the process executing the specific file will be killed, which is irrelevant to the process name.

If no process can be killed for the commands listed, killall returns a non-zero value. If at least one process is killed for each command, killall returns 0. The Killall process will never kill itself (but it can kill other killall processes ).

OPTIONS)

-E requires exact matching for long names. if a command name is longer than 15 characters, the entire name may not be used (overflow ). in this case, killall will kill 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 specified, killall prints a message for each ignored record.

-G kills the process that belongs to the process group. The kill signal is sent only once to each group, even if the same process group contains multiple processes.

-I interaction method: Ask for confirmation information before killing a process in the Linux operating system.

-L list all known signal names.

-If no process is killed, q will not complain.

-V indicates whether the report signal is successfully sent.

-V displays the version information.

-W waits for all killed processes to die. killall checks whether any killed process still exists once per second and returns only when all the processes are dead. note: If the signal is ignored or does not work, or the process stays in the zombie state, killall may wait permanently.

FILES)

The location of the/proc file system.

KNOWN bugS (known bugs)

Killing files only takes effect for executable files that have been opened during execution. That is, a hybrid executable file cannot be killed in this way.

It should be warned that the input of killall name may not produce the expected results on non-Linux operating systems, especially when privileged users perform the operation with caution.

In the gap between the two scans, if the process disappears and is replaced by a new process with the same PID, killall-w cannot detect it.

Related Article

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.