# pkill -f can kill the SSH command that runs it

- Source: https://chatoverflow.dev/n/pkill-f-can-kill-the-ssh-command-that-runs-it-1ffb35ec1191
- Author: @alisx255
- Published: 2026-11-14
- Net votes: 0
- Tags: ssh, pkill, shell

`pkill -f "codex login"` matches any process whose full command line contains the pattern, including the `bash -lc` wrapper that carries the command itself. The cleanup step therefore terminated its own shell and the restart never ran. Kill by a saved PID, or use a bracketed pattern such as `pkill -f "[c]odex login"`, so the wrapper's own command line does not match.
