Use process cmd from ps-list (instead of/with) the name
I think it would be easer to find a process if the full command is used instead of the name. Indeed, if i have couple of node process running in background, i will have
node 1337
node 1338
node 1339
but if the full command is displayed
node foo.js 1337
node bar.js 1338
node foo-bar.js 1339
an other display could be
node 1337 `node foo.js`
node 1338 `node bar.js`
node 1339 `node foo-bar.js`
I added support for this with PR #14 - if that gets merged then searching by full command will be possible with fkill -v
The reason I didn't use the command with arguments by default is that it's very verbose. It includes the full path to the binary. I could find no way to just extract the arguments as I couldn't split on a space as ps returns paths with spaces unquoted (Happy to be shown otherwise!).
Ideally we would show the binary (without full path) and arguments by default, but as I said, I couldn't find a way to do it cleanly. We could maybe do it for known cases like python and node as we know the binary name, so we could predictable parse it.
I looked into this more, and I might have a solution to get the arguments without the full path. It seems ps -o pid -o comm returns the full path without arguments and ps -o pid -o command returns with arguments. So we could get both columns and just diff them to get the arguments. I think this should be added as a new property in ps-list. So we could add an args property with just the arguments and a path property with the full path to the binary without arguments, just for completeness.
:) I came to the same conclusion last night - wasn't sure how to sort it for Windows users though (and also don't have a window machine, so could not test)
Shall I leave the changes to ps-list to you? Perhaps, if you're busy, we could look at the integration back into fkill-client in another merge and complete this PR #14 without it?
wasn't sure how to sort it for Windows users though (and also don't have a window machine, so could not test)
Seems like it should be possible: http://superuser.com/questions/415360/how-do-i-find-out-command-line-arguments-of-a-running-program, but I'm not that concerned about it. We can leave it as PR welcome if any Windows users wants it.
Shall I leave the changes to ps-list to you? Perhaps, if you're busy, we could look at the integration back into fkill-client in another merge and complete this PR #14 without it?
I probably won't have time to do the ps-list changes, so I'll leave them PR welcome, but your PR is not dependent on it.
I opened an issue on ps-list: https://github.com/sindresorhus/ps-list/issues/7 (Help welcome)
I'd like to counter that often the path of the binary is useful for searching, I often kill python processes by searching for the virtualenv the bin is located in. g.g. if I want to kill all processes for a particular project, I'll search for ~/.virtualenvs/projectname/bin.
Maybe we could allow searching the full path, but display an abbreviated version if it's above a certain number of characters?
/bin/sh -c "echo hi"
/U/n/.v/p/bin/python arg1 arg2 arg3 <- path shortened to first letter of each dir except last one
@pirate Good point. I would differentiate plain binaries and apps though. For apps you don't care about the path, but you might for binaries. Maybe just doing /Users/sindresorhus/dev/bin/python -> ~/dev/bin/python would be enough. What would have been more useful than the full path is to include the path of where the binary was started, but I don't think that information is available.
You can see the full path with fkill -v now.