Linux command--end the process according to the java application name

Original URL: Linux command--end the process according to the java application name_IT Knives Out Blog-CSDN Blog

Introduction

This article introduces the Linux command to end (kill) the process based on the application name of jps -l.

The method is: jps + grep + kill

Order

jps -l | grep procedure_name  | grep -v grep | awk '{print $1}' | xargs kill

procedure_name is the process name.

analyze

  1. jps -l
    1. List all java processes (with application name)
  2. grep procedure_name
    1. Find the process with the specified process name
  3. grep -v grep
    1. Do not display processes with grep (that is, the process corresponding to this grep command)
  4. awk '{print $1}'
    1. Filter out process ID
  5. xargs kill
    1. Kill specified process

Guess you like

Origin blog.csdn.net/feiying0canglang/article/details/128242091