Gangmax Blog

自由之思想,独立之精神

One Line Command to Kill Specific Application

| Comments

From here. The key is:

  1. use pipe;

  2. get the PID by using the “cut” command on the output of the “jps/ps” command and send the PID to the “kill” command.

  1. The original commands.
1
2
3
4
> jps
13153 Jps
12819 Bootstrap
> kill -15 12819
  1. The one line command.
1
jps | grep Bootstrap | cut -d' ' -f1 | xargs kill -15

Comments