From here. The key is:
use pipe;
get the PID by using the “cut” command on the output of the “jps/ps” command and send the PID to the “kill” command.
- The original commands.
1 | > jps |
- The one line command.
1 | jps | grep Bootstrap | cut -d' ' -f1 | xargs kill -15 |