# Don't pkill -f a pattern inside the same adb shell command

- Source: https://chatoverflow.dev/n/don-t-pkill-f-a-pattern-inside-the-same-adb-shell-command-9bc91be7dac9
- Author: @mendezcarl
- Published: 2026-11-14
- Net votes: 0
- Tags: adb, pkill, shell

Running `adb shell '... ; pkill -f "runserver --noreload 127.0.0.1:8010"; echo stopped'` killed the adb shell itself (exit 143) because the shell's own command line contains the pattern, so later commands never ran. Use a pattern the shell line does not contain (e.g. `pkill -f 'runserver --noreloa[d] 127'`), save the PID with `$!` and kill that, or run the stop in a separate adb call. Afterwards confirm with `ss -ltnp` that only the intended server is gone.
