Skip to main content
added 152 characters in body
Source Link
kos
  • 4.3k
  • 1
  • 15
  • 28

All you need is pgrep:

pgrep -fa 'file\.jar' 
  • -f: forces pgrep to match the extended regular expression against the full invocation command-line¹ which will include the filename.
  • -a: forces pgrep to output the full invocation command-line (which will include the filename), auto-folding lines exceeding the terminal's width.

By doing this, you'll get a list of process IDs matching the expression, along with their full invocation command-line, with each entry nicely folding onto multiple lines if needed.

At that point, you can just kill the right pid, or pass the same regexp to pkill -f instead of pgrep -fa (if using the second method, make sure you only have your target process on the list produced by pgrep -fa 'file\.jar' as that will signal all processes matching the regular expression file\.jar).


Another way: if available, you can just use htop and scroll to the right using arrow keys.


Another possible way: I'm pretty sure signaling the screen process correctly will also enforce propagation and consequently termination to the child. I'll maybe figure this out and report back, I'm kinda rusty on this topic.


¹ Technically, with current versions of the procps implementation of pgrep on Linux-based systems at least, that's the concatenation with spaces of the arguments passed to the last execve() system call that the process (or any of its ancestors) made, with some escaping of some characters, and truncated to 128KiB, the same thing as reported by procps' ps -wwo args= for the pid.

All you need is pgrep:

pgrep -fa 'file\.jar' 
  • -f: forces pgrep to match the extended regular expression against the full invocation command-line¹ which will include the filename.
  • -a: forces pgrep to output the full invocation command-line (which will include the filename), auto-folding lines exceeding the terminal's width.

By doing this, you'll get a list of process IDs matching the expression, along with their full invocation command-line, with each entry nicely folding onto multiple lines if needed.

At that point, you can just kill the right pid, or pass the same regexp to pkill -f instead of pgrep -fa.


Another way: if available, you can just use htop and scroll to the right using arrow keys.


Another possible way: I'm pretty sure signaling the screen process correctly will also enforce propagation and consequently termination to the child. I'll maybe figure this out and report back, I'm kinda rusty on this topic.


¹ Technically, with current versions of the procps implementation of pgrep on Linux-based systems at least, that's the concatenation with spaces of the arguments passed to the last execve() system call that the process (or any of its ancestors) made, with some escaping of some characters, and truncated to 128KiB, the same thing as reported by procps' ps -wwo args= for the pid.

All you need is pgrep:

pgrep -fa 'file\.jar' 
  • -f: forces pgrep to match the extended regular expression against the full invocation command-line¹ which will include the filename.
  • -a: forces pgrep to output the full invocation command-line (which will include the filename), auto-folding lines exceeding the terminal's width.

By doing this, you'll get a list of process IDs matching the expression, along with their full invocation command-line, with each entry nicely folding onto multiple lines if needed.

At that point, you can just kill the right pid, or pass the same regexp to pkill -f instead of pgrep -fa (if using the second method, make sure you only have your target process on the list produced by pgrep -fa 'file\.jar' as that will signal all processes matching the regular expression file\.jar).


Another way: if available, you can just use htop and scroll to the right using arrow keys.


Another possible way: I'm pretty sure signaling the screen process correctly will also enforce propagation and consequently termination to the child. I'll maybe figure this out and report back, I'm kinda rusty on this topic.


¹ Technically, with current versions of the procps implementation of pgrep on Linux-based systems at least, that's the concatenation with spaces of the arguments passed to the last execve() system call that the process (or any of its ancestors) made, with some escaping of some characters, and truncated to 128KiB, the same thing as reported by procps' ps -wwo args= for the pid.

added 483 characters in body
Source Link
Stéphane Chazelas
  • 586.2k
  • 96
  • 1.1k
  • 1.7k

All you need is pgrep:

pgrep -fa 'file'file\.jar' 
  • -f: forces pgrep to match the extended regular expression against the full invocation command-line (whichline¹ which will include the filename).
  • -a: forces pgrep to output the full invocation command-line (which will include the filename), auto-folding lines exceeding the terminal's width.

By doing this, you'll get a list of process IDs matching the expression, along with their full invocation command-line, with each entry nicely folding onto multiple lines if needed.

At that point, you can just pkillkill the right pid, or pass the same regexp to pkill -f instead of pgrep -fa.


Another way: if available, you can just use htop and scroll to the right using arrow keys.


Another possible way: I'm pretty sure signaling the screen process correctly will also enforce propagation and consequently termination to the child. I'll maybe figure this out and report back, I'm kinda rusty on this topic.


¹ Technically, with current versions of the procps implementation of pgrep on Linux-based systems at least, that's the concatenation with spaces of the arguments passed to the last execve() system call that the process (or any of its ancestors) made, with some escaping of some characters, and truncated to 128KiB, the same thing as reported by procps' ps -wwo args= for the pid.

All you need is pgrep:

pgrep -fa 'file.jar' 
  • -f: forces pgrep to match the expression against the full invocation command-line (which will include the filename).
  • -a: forces pgrep to output the full invocation command-line (which will include the filename), auto-folding lines exceeding the terminal's width.

By doing this, you'll get a list of process IDs matching the expression, along with their full invocation command-line, with each entry nicely folding onto multiple lines if needed.

At that point, you can just pkill the right pid.


Another way: if available, you can just use htop and scroll to the right using arrow keys.


Another possible way: I'm pretty sure signaling the screen process correctly will also enforce propagation and consequently termination to the child. I'll maybe figure this out and report back, I'm kinda rusty on this topic.

All you need is pgrep:

pgrep -fa 'file\.jar' 
  • -f: forces pgrep to match the extended regular expression against the full invocation command-line¹ which will include the filename.
  • -a: forces pgrep to output the full invocation command-line (which will include the filename), auto-folding lines exceeding the terminal's width.

By doing this, you'll get a list of process IDs matching the expression, along with their full invocation command-line, with each entry nicely folding onto multiple lines if needed.

At that point, you can just kill the right pid, or pass the same regexp to pkill -f instead of pgrep -fa.


Another way: if available, you can just use htop and scroll to the right using arrow keys.


Another possible way: I'm pretty sure signaling the screen process correctly will also enforce propagation and consequently termination to the child. I'll maybe figure this out and report back, I'm kinda rusty on this topic.


¹ Technically, with current versions of the procps implementation of pgrep on Linux-based systems at least, that's the concatenation with spaces of the arguments passed to the last execve() system call that the process (or any of its ancestors) made, with some escaping of some characters, and truncated to 128KiB, the same thing as reported by procps' ps -wwo args= for the pid.

Source Link
kos
  • 4.3k
  • 1
  • 15
  • 28

All you need is pgrep:

pgrep -fa 'file.jar' 
  • -f: forces pgrep to match the expression against the full invocation command-line (which will include the filename).
  • -a: forces pgrep to output the full invocation command-line (which will include the filename), auto-folding lines exceeding the terminal's width.

By doing this, you'll get a list of process IDs matching the expression, along with their full invocation command-line, with each entry nicely folding onto multiple lines if needed.

At that point, you can just pkill the right pid.


Another way: if available, you can just use htop and scroll to the right using arrow keys.


Another possible way: I'm pretty sure signaling the screen process correctly will also enforce propagation and consequently termination to the child. I'll maybe figure this out and report back, I'm kinda rusty on this topic.