While testing a new service you accidentally started three separate copies of a program called "myapp". You confirm with ps that all three processes are running under your user account and you only want to terminate the single newest (most recently started) instance without touching the two older ones. Which command would accomplish this goal?
The -n (newest) option tells pkill to select only the most recently started process that matches the given pattern. Combining it with -9 (or placing -9 before the pattern) sends the SIGKILL signal to that one process. Using -o would target the oldest instance instead, -f would match the full command line but would still kill all matching processes, and killall would send the signal to every process named "myapp". Therefore, only the command that includes pkill -9 -n myapp meets the requirement of killing just the single newest instance.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of the `-n` option in the `pkill` command?
Open an interactive chat with Bash
How does `pkill` differ from `killall`?
Open an interactive chat with Bash
What does the `-9` option do when used with commands like `pkill` or `killall`?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Services and User Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access