Skip to content
shellmap

Send a signal to a process

Deliver a specific Unix signal to a process — useful for graceful shutdown, config reload, and triggered behaviour.

How to send a signal to a process in each shell

Bashunix
kill -TERM 12345
Zshunix
kill -TERM 12345
Fishunix
kill -TERM 12345
PowerShellwindows
Stop-Process -Id 12345 -Force

Windows has NO signals — `Stop-Process` is SIGKILL-equivalent (uncatchable, no userspace handler runs). There is no built-in soft-shutdown for non-GUI processes.

cmd.exewindows
taskkill /F /PID 12345

`taskkill` without `/F` sends `WM_CLOSE` to the process's main window — works only for GUI apps with a message loop. Services and console apps ignore it.

Equivalents listed for Bash, Zsh, Fish, PowerShell, cmd.exe.

Gotchas & notes

  • `kill -l` lists all signal names + numbers supported by the running kernel. The Big Three: **SIGTERM** (15, default — polite "clean up and exit", catchable + ignorable); **SIGKILL** (9, uncatchable + unblockable + unignorable — the kernel kills the task directly, no userspace handler runs, no chance to flush buffers or release locks); **SIGHUP** (1, "hangup" — historically a tty disconnect, now CONVENTION for "reload your config" — nginx, apache, sshd, syslogd all reload on SIGHUP). Don't lead with `-9`: apps holding open files / DB transactions / advisory locks lose data.
  • Common signal idioms: `SIGINT` (2 — what Ctrl-C sends); `SIGQUIT` (3 — Ctrl-\, default action is core-dump); `SIGUSR1`/`SIGUSR2` (app-defined — logrotate sends `SIGUSR1` to nginx to reopen log files: `kill -USR1 $(cat /var/run/nginx.pid)`); `SIGSTOP` (uncatchable pause — sister to SIGKILL) vs `SIGTSTP` (Ctrl-Z, catchable); `SIGCONT` (resume from STOP/TSTP). Bash: `trap 'echo got SIGHUP; reload_config' HUP` registers a handler. Fish: `function on_term --on-signal TERM; reload; end`.
  • WINDOWS HAS NO POSIX SIGNALS. `Stop-Process` and `taskkill /F` are SIGKILL-equivalent — there's no kernel-level catchable signal mechanism. For "graceful shutdown" of a console app you have to send Ctrl-C via the `GenerateConsoleCtrlEvent` Win32 API — the `windows-kill` utility on Chocolatey wraps this (`windows-kill -SIGINT 12345`). For Windows Services, `Stop-Service` respects the service's `OnStop()` handler (the .NET equivalent of a SIGTERM handler).
  • Signal NUMBERS diverge between Linux and BSD/macOS: `SIGUSR1` is 10 on Linux, 30 on FreeBSD/macOS; `SIGUSR2` is 12 vs 31; the realtime range is 34–64 on Linux, 32–63 elsewhere. Cross-platform scripts MUST use the symbolic name (`-USR1`, `-TERM`) not the number — `kill -10` reloads nginx on Linux but suspends a process on macOS. `kill -l USR1` returns the local number; use it programmatically rather than hard-coding.

Related commands

Related tasks