Send SIGTERM to processes owned by alice whose name exactly matches backup.
Which command is appropriate?
pkill selects processes by attributes and sends a signal. -u selects the effective user and -x requires an exact name match.
Detailed explanation
kill alice backupIncorrect. kill does not accept a user and process-name filter in this form.
pgrep -u alice -x backupIncorrect. pgrep only prints matching PIDs and does not send SIGTERM.
pkill -u alice -x backupCorrect. pkill -u alice -x backup sends the default SIGTERM to matching processes.
jobs -u alice backupIncorrect. jobs does not select arbitrary processes by user and name.
Try it yourself
An example you can run in a temporary verification environment.
pkill --help | grep -E -- '--euid|--exact|-u|-x'Expected result
-uと-x optionのhelpKey points
- pkill
- -u
- -x
Notes
- Environment: procps-ng系pkill help
- Use a disposable process or test shell when checking lifecycle commands.
- Exact output and option names can vary slightly by distribution and tool version.
Foundation review
Place the operation
pkill combines selection and signaling; pgrep can preview the same match without sending a signal.
Check the side effect
Preview a potentially broad match with pgrep before using pkill in production.