Kill a process by name
Terminate every running process whose executable matches a given name.
How to kill a process by name in each shell
Bashunix
pkill firefox`pkill` matches against the process name. Use `pkill -f` to match against the **full command line** (catches scripts launched as `python myscript.py`).
Zshunix
pkill firefoxFishunix
pkill firefoxPowerShellwindows
Stop-Process -Name firefoxNo `.exe` suffix. `-Force` skips the confirmation prompt for non-graceful kills. Preview with `Get-Process firefox` before pulling the trigger.
cmd.exewindows
taskkill /F /IM firefox.exe`/IM` matches by image name and **requires the .exe suffix**. `/F` forces termination — without it, only a polite close request is sent.
Equivalents listed for Bash, Zsh, Fish, PowerShell, cmd.exe.
Gotchas & notes
- macOS ships `pkill` too. `killall` exists on both Linux and macOS but has different semantics — on Linux it kills by name, on legacy Solaris-influenced systems it killed **every** process. macOS matches Linux behaviour.
- PowerShell `Stop-Process -Name` does **not** want the `.exe` suffix; cmd `taskkill /IM` **does**. Both are case-insensitive on Windows.
- To kill a process and all its children: `pkill -P <ppid>` (bash) or `Stop-Process -Id <pid> -Force` after enumerating children via `Get-CimInstance Win32_Process`.
- Avoid `kill -9 $(pidof name)` — it's racy and `pidof` is Linux-only (no macOS). `pkill` handles the lookup atomically.