Proficient in Linux "kill" commands

Source: Internet
Author: User
Tags pkill
The kill command that is proficient in Linux no matter which operating system you use, you will surely encounter an abnormal application that locks itself and refuses to close it. In Linux (and Mac), you can use the & quot; kill & quot; command to force it to end. In this tutorial, we will show you how to use the & quot; kill command that is proficient in Linux, no matter which operating system you use, you will surely encounter an abnormal application that will lock yourself and refuse to close it. In Linux (and Mac), you can use a "kill" command to force it to end. In this tutorial, we will show you how to use the "kill" command to end the application. Kill Command and signal when you execute a "kill" command, you actually send a signal to the system to end abnormal applications. There are a total of 60 signals you can use, but basically you only need to know SIGTERM (15) and SIGKILL (9 ). You can use this command to view the list of all signals: kill-l SIGTERM-this signal requests a process to stop running. This signal can be ignored. A process can be shut down normally for a period of time. it usually takes some time to save the progress and release resources. In other words, it is not forced to stop. SIGKILL-this signal forces the process to stop running immediately. The program cannot ignore this signal, but the unsaved progress will be lost. The syntax for "kill" is: kill [signal or option] PID (s) default signal (when not specified) is SIGTERM. When it does not work, you can use the following command to force kill a process: kill sigkill pid or kill-9 PID here "-9" represents the SIGKILL signal. If you do not know the PID of the application, you only need to run this command: ps ux, which will display the PID of all running applications and applications. For example, to kill Chrome, I will run the command: kill-9 3629 or kill multiple processes at the same time. The kill-9 PID1 PID2 PID3PKill "pkill" command allows the use of extended regular expressions and other matching methods. You can kill the application process name instead of the PID. For example, to kill the Firefox browser, you only need to run the command pkill firefox to match with a regular expression. you can enter some characters of the process name, for example: pkill fire to avoid kill the wrong process, you should use the "pgrep-l [process name]" list to match the process name. Killallkillall also uses the process name to replace the PID, and it will kill all processes with the same name. For example, if you are running multiple Firefox browser instances, you can kill them all by using the command: killall firefox in Gnome. you can use this command to restart Nautilus: killall nautilusxkillxkill is an application killed in graphical mode. When you type "xkill" on the terminal, your cursor will immediately become a "cross ". You only need to click on an abnormal application, and it will kill the application immediately. If you often use it, you can also add a keyboard shortcut to activate xkill. Conclusion when the system is suspended due to abnormal applications, people often restart the computer and start all the tasks again. With these "kill" commands, you can better handle abnormal applications and avoid system crashes. It is especially useful when you don't want to cause server downtime because of an abnormal 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.