Send signals to processes: kill, killall, and top

Source: Internet
Author: User
Article Title: send signals to processes: kill, killall, and top. 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.

These two commands are used to send signals to processes. The kill command requires the process number as the parameter, while the killall Command requires the process name.

In addition, you can add the signal number to be sent as the parameter after the two commands. By default, they all send signals to related processes 15 (TERM ). For example, if you want to terminate a process whose PID is 785, enter the following command:

$ Killed 785

If you want to send a signal 19 (STOP) to it, enter:

$ Kill-19 785

Assume that you know the command name of the process to be terminated. You can terminate a process by using this name, instead of using ps to find the process ID:

$ Killall-9 mozilla

In any case, you can only terminate your own processes (unless you are the root user), so when you run multi-user systems, you do not have to worry about your "Neighbor" processes, they will not be affected.

Integrated ps and kill: top

The top program completes ps and kill functions at the same time, and can be used to monitor the CPU and memory usage and execution time of processes in real time. "Use top monitoring process.

  

Figure top monitoring process

The top tool is fully controlled by the keyboard. Press h to access the help information. The most useful command is as follows:

K: used to send signals to a process. Top then you will be asked about the PID of your process and the serial number or name of the signal to be sent (default: TERM, that is, signal 15 );

M: processes are sorted by memory usage (% MEM column;

P: processes are sorted by CPU usage time (% CPU by default;

U: displays the process of a given user. Top will ask you which user it is. Enter the user name instead of his UID. If you do not enter any name, all processes are displayed;

I: All processes, including sleep processes, are displayed by default. This command ensures that only processes currently running are displayed (processes whose STAT column is R (run ). Enter the command again to display all processes.

R: changes the priority of the selected process.

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.