3 ms·
Check out my entry, marcel: https://marceltheshell.org https://marceltheshell.org. E.g., find the newest vlc instance and kill it (a command that an acquaintan
by geophile 3y ago
Check out my entry, marcel: https://marceltheshell.org https://marceltheshell.org.
E.g., find the newest vlc instance and kill it (a command that an acquaintance needs frequently, for some reason):
ps | select (p: p.name == 'vlc') | sort (p: p.create_time) | tail 1 | (p: p.signal(9))
- ps produces a stream of Process objects.
- select binds each Process to p, and then selects those whose name is vlc. (Anything in parens is a Python function. You can include or omit "lambda".)
- sort by create time, (using a Python function to specify the sort criterion).
- tail 1 as in Linux, to get the newest qualifying Process.
- Run the function p.signal(9), which kills the Process.