Back to the command reference

pkill

ProcessesFundamentals In real Linux

Signal processes by name

Name: pkill = process kill

This command needs a real Linux system; you can practise it in real Linux mode.

Description

pkill signals processes matched by name or other attributes, SIGTERM by default. It uses the same matching as pgrep, so check with pgrep first.

Syntax

pkill [OPTION]... PATTERN

Common options

-9Force kill
-f / --fullMatch the full command line
-x / --exactThe name must match exactly (spares similar names)
-u / --euid USEROnly a user's processes
-n / --newestOnly the newest one
-e / --echoShow what was signalled

Examples

  • $ pkill firefox

    Close every firefox process

    Explain
  • $ pkill -f "python server.py"

    Match by full command

    Explain

Related