Methods for shutting down all terminals under Linux (Killall and kill encyclopedia) __linux

Source: Internet
Author: User


Killall Use methods (end most processes)

Reference: Http://www.cnblogs.com/peida/archive/2012/12/21/2827366.html

The Killall command in the Linux system kills the process with the specified name (kill processes by name). We can use the KILL command to kill the process of the specified process PID, if we want to find the process we need to kill, we also need to use the PS and other commands to find the process with grep, and killall the two processes together, is a very useful command.

1. command format:

killall[parameter] [process name]

2. Command function:

Used to end all processes with the same name

3. Command parameters:

-Z only kills processes that have Scontext

-e requires matching process name

-I ignores lowercase

-G kills process groups rather than processes

-I interactive mode, before killing the process to ask the user first

-l list all known signal names

-Q does not output warning messages

-S sends the specified signal

-V report signal is sent successfully

-W waits for process to die

--HELP Display Help information

--version Display version display

4. Use instance:

Example 1: kill all processes with the same name

command:

Killall VI

Output:

[Root@localhost ~]# Ps-ef|grep VI

Root 17581 17398 0 17:51 pts/0 00:00:00 vi test.txt

Root 17611 17582 0 17:51 pts/1 00:00:00 grep VI

[Root@localhost ~]# Ps-ef|grep VI

Root 17581 17398 0 17:51 pts/0 00:00:00 vi test.txt

Root 17640 17612 0 17:51 pts/2 00:00:00 VI test.log

Root 17642 17582 0 17:51 pts/1 00:00:00 grep VI

[Root@localhost ~]# Killall VI

[Root@localhost ~]# Ps-ef|grep VI

Root 17645 17582 0 17:52 pts/1 00:00:00 grep VI

Description:

Example 2: send a specified signal to a process

command:

Background Running program: VI &

Kill VI Process: Killall-term VI or Killall-kill VI

Output:

[Root@localhost ~]# VI &

[1] 17646[root@localhost ~]# killall-term VI

[1]+ Stopped VI

[Root@localhost ~]# VI &

[2] 17648[root@localhost ~]# ps-ef|grep VI

Root 17646 17582 0 17:54 pts/1 00:00:00 VI

Root 17648 17582 0 17:54 pts/1 00:00:00 VI

Root 17650 17582 0 17:55 pts/1 00:00:00 grep VI

[2]+ Stopped VI

[Root@localhost ~]# Killall-term VI

[Root@localhost ~]# Ps-ef|grep VI

Root 17646 17582 0 17:54 pts/1 00:00:00 VI

Root 17648 17582 0 17:54 pts/1 00:00:00 VI

Root 17653 17582 0 17:55 pts/1 00:00:00 grep VI

[Root@localhost ~]# Killall-kill VI

[1]-has killed VI

[2]+ has killed VI

[Root@localhost ~]# Ps-ef|grep VI

Root 17656 17582 0 17:56 pts/1 00:00:00 grep VI

[Root@localhost ~]#

Description:

Example 3: kill all of the shell that's logged in.

command:

Killall-9 Bash

Output:

[Root@localhost ~]# W

 18:01:03 up 41 days, 18:53,  3 users,  load average :  0.00, 0.00, 0.00user     tty      from               login@ 

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.