Linux has at least four levels of decreasing pleasantry: -1, -2, -15, and -9, aka HangUP, INTerrupt, TERMinate and KILL or "Please stop", "Hey! Quit it!", "Stop it! NOW!" and *loud gunshot*.
Sometimes processes will clean up after themselves and leave when asked nicely. Or sternly told off. Of course, if you don't need or want that, load up your, uh, -9 shooter.
On Linux you can "ask" a program to close. That's what happens when you press close. (Sigterm)
However, you can also use sigkill which really should not be used. That just tells the kernel to stop execution of that process. That won't do things like remove resource locks. All it does is free up the memory and remove the process from the scheduler.
On Windows, there is no such thing as signals. There is a equivalent system however. If you want to gracefully close a program you can simulate the pushing of the close button. This is pretty much equivalent to a user pushing the close button. If you want kill a program you can use terminate process which tells the Windows kernel to stop running the process and to clean up memory. However, this doesn't clear any resource locks and will also cause issues.
The big take away is that it is a really bad idea to kill applications instead of letting them terminate. This will create things like zombie processes and locked files no matter what system you are on.
Also just a little bit of Windows foo:
taskkill /IM process.exe ask a process to terminate. Runs cleanup code and gracefully exits
taskkill /F /IM process.exe kills the program. Exits uncleanly and will break things.
From my experience, killing a process from task manager does free up any file locks held by the process. However, I wouldn't consider it being graceful, any in-app cleanup is lost this way.
There is no concept of locked files in extfs, much less inside the kernel. Resource locks and unkillable processes is some windows bullshit that no sane operating system would touch with a ten foot pole.
killall -9 processname works well when you can't be asked to get the pid.
kill -9 $$ is my favourite way to save face when I enter something into shell that shouldn't be in its history. Usual situation - switching panes and forgetting a recently used sudo session. Switching to root and getting there without a password prompt, but still typing it in. Wouldn't be helpful in situations where shell history is monitored remotely, but hey ho.
It's still a good habit to get into as this kind of thing could potentially bite you nastily if you ever end up on the wrong machine (which can happen).
Start using the detail tab only and kill the actual image name. It will always kill it immediately. The first tab is a joke in task manager. In the ultra rare case it doesnβt for some really really crazy reason, tasklist / task kill by name or pid
One of the only things I still miss after switching to Wayland is xkill. I even had it set to a keybind in early Plasma 5. To be fair I have less applications freeze on me these days since I'm not using ancient hardware.
all 43 comments