fkill-cli icon indicating copy to clipboard operation
fkill-cli copied to clipboard

Kill all

Open alextes opened this issue 8 years ago • 9 comments

Issuehunt badges

I currently have to run fkill about 5 times when I search for python. It would be nice if I could somehow request either:

Kill all exact matches Kill all visible, suggested processes on my screen

Do others have a need for this? (:thumbsup:) Maintainers interested in a PR?

There is a $40.00 open bounty on this issue. Add more on Issuehunt.

alextes avatar Mar 09 '17 11:03 alextes

When running fkill python it should definitely kill all the processes matching exactly. The interactive interface however is fuzzy searched, so I think it would be surprising if it killed all exact matches. Instead we could maybe add a shortcut command, like press Option while killing a process, to kill all other with the same name? Happy to consider other options.

// @coffeedoughnuts

sindresorhus avatar Mar 09 '17 13:03 sindresorhus

It does. I was talking about interactive mode. Should've clarified this.

After thinking about this more, I believe that you're precisely right.

  1. Either you know what you're looking for exactly and want to kill it or you don't and want to search.

fkill covers the first use case entirely. If you search, however, it is still very likely that whatever it is you were looking for, you want to kill all of it. Now intuitively, I feel you would expect fkill-cli to kill the selected option, not all processes by that exact name. So the default I'd say is perfect as-is.

That leaves: how could one signal to kill all processes by the same selected name. If I'm searching for a process to kill and more than one result of the same process come up, in most cases I can dream up I'd like to kill all of them. I can think of few scenarios where you'd only want to kill one of them. Your suggestion of a adding a modifier key is the best UI design with which I can come up. Maybe turning it into a checkbox list on Space (<- that took me a while 😅 ) is also worth considering.

Here's the kicker, since fkill supports kill all by cli argument, I don't think we should do this. I lost my common use-case to functionality that is already there. The use-case I propose in this comment will happen, but how often? I like to air on the side of simplicity. I say no implementing this until this issue has some votes. I'd be happy to PR the functionality myself at that point. What say you guys?

alextes avatar Mar 09 '17 17:03 alextes

Yes. Let's keep it open for a while and see what others think.

sindresorhus avatar Mar 10 '17 09:03 sindresorhus

I've had a personal fish version of this command for years that works quite similarly, with progressive narrowing of options using fuzzy-searching of the whole command string with args. It has an all option, might be useful as inspiration:

screen shot 2017-03-14 at 1 33 44 am

It also supports the cli option --all to indiscriminately kill all fuzzy-matches: screen shot 2017-03-14 at 1 35 19 am

pirate avatar Mar 14 '17 05:03 pirate

pkill "python" or pkill "process_name" is an excellent built-in command on *nix. May be this command can be interfaced with fkill. Just a thought.

Thanks

igauravsehrawat avatar Oct 17 '17 05:10 igauravsehrawat

@issuehunt has funded $40.00 to this issue. See it on IssueHunt

IssueHuntBot avatar Feb 19 '19 05:02 IssueHuntBot

@sindresorhus What exactly do we want to do here? Use pkill inside fkill for part of the cases?

stroncium avatar Mar 05 '19 21:03 stroncium

@stroncium I would say let's start with figuring out what the value is for the user here. That should be both simpler and more valuable than working backwards from how pkill works. After all, it seems fkill process_name works like that already.

I wanted to make some suggestions but the more I think about it the less I can imagine how this could be helpful 😅 . Indeed pressing option, showing a warning we're about to kill everything by that name, and maybe how many processes that is sounds the most helpful to me.

However, I'd much prefer for someone that finds this issue to explain what they'd like fkill-cli to do. Like I mentioned two years ago I lost my use-case when Sindre explained fkill can already kill by process name i.e. fkill python.

alextes avatar Mar 11 '19 18:03 alextes

I personally would find it useful to be able to filter (in interactive mode) the list of running processes, and then kill all remaining processes listed by either name or port. e.g. I frequently use node with debug mode, so I usually end up running fkill, then typing :9 to show my node programs. Hitting a special key or even going through each one and marking it as a program to kill would be fantastic. image

nerdkid93 avatar Jul 01 '19 17:07 nerdkid93