p4 monitor


Display Perforce process information; control long-running tasks.


p4 [g-opts] monitor show [-a -l -e -L [-s R/T/P/I]
p4 [g-opts] monitor terminate id
p4 [g-opts] monitor clear id
p4 [g-opts] monitor clear all
p4 [g-opts] monitor pause id
p4 [g-opts] monitor resume id


p4 monitor allows a system administrator to observe and control Perforce-related processes running on a Perforce server machine.

To use p4 monitor, you must enable monitoring on the Perforce service by setting the monitor configurable with p4 configure. You can control process monitoring by setting the monitor configurable to 0 (disable monitoring), 1 (enable monitoring of active processes), or 2 (enable monitoring of both active and idle processes). Values of 5, 10, and 25 relate to obtaining lock information.

Command syntax variants provide the following alternatives:

  • To list current process information, use p4 monitor show. By default, all processes are listed, but only the command (for example, sync, edit, submit) is shown, without arguments. This form of p4 monitor requires list level access. Use the -s status option to restrict the display to processes in the specified state.

    To show the list of arguments associated with each command, use the -a (arguments) option or -l (long) option. For additional information from the user environment, use the -e (environment) option. These options require admin level access. Use the -L option to show locked files.

  • To mark a process for termination, use p4 monitor terminate id. This command requires super level access.

    The p4 monitor terminate command will not mark a process for termination unless the process has been running for at least ten seconds. Some commands, such as p4 obliterate, cannot be terminated.

  • To remove an entry from the monitor table, use p4 monitor clear id. You can clear the entire table with p4 monitor clear all. Both of these commands require super level access.

    Processes marked as running continue to run to completion even if removed from the monitor table with p4 monitor clear.

  • To control long-running tasks such as p4 verify or p4 pull, use the p4 monitor pause and p4 monitor resume commands.

Each line of p4 monitor output consists of the following fields:

pid status owner hh:mm:ss command [args]


The process ID under Unix (or thread ID under Windows)


R, T, P, or I, depending on whether the process is Running, marked for Termination, Paused, or Idle.


The Perforce user name of the user who invoked the command.


The time elapsed since the command was called.

command [args]

The command and arguments as received by the Perforce service.

For example, consider the following output to the p4 monitor show -L command, which displays information about locked files:

8764 R user 00:00:00 edit
8766 R user 00:00:00 edit
8768 R user 00:00:00 monitor

Following pid, status, owner, and time information, this shows two edit commands that have various files locked, including the client workspace lock in exclusive mode for the workspaces ws4 and ws5, and db.locks and db.rev tables in read-only mode.



Show all arguments associated with the process (for example, edit file.c, or sync -f //depot/src/...).

Perforce user names are truncated to 10 characters, and each line is limited to a total of 80 characters of output.


Show environment information including invoking Perforce application (if known), host IP address, and workspace name.


Show all arguments in long form; that is, without truncating user names or the list of command line arguments.


Show information about locked files. The information is collected only for the duration of the p4 monitor command, and is not persisted. Pre-requisites for using this option vary with the platform on which the server is running.

  • On Unix platforms, you must set the monitor.lsof configurable to the following value:

    path/lsof -F pln

    The value for path varies with the version of Unix you are using. For example, /usr/bin/lsof.

    There are circumstances in which monitor.lsof might not work for you: your Linux machine does not support lsof, the version of lsof might not work with the Perforce server, or the administrator might not be willing to run the lsof command for security reasons. If this is the case, you can still get information about locked files by setting the monitor configurable, described next.

  • On non-Unix platforms or if monitor.lsof cannot be used, you must set the monitor configurable to 5, 10, or 25:

    5: monitor both active commands and idle connections, including a list of the files locked by the command for more than one second.

    10: monitor both active commands and idle connections, including a list of the files locked by the command for more than one second, with lock wait times included in the lock information.

    25: monitor both active commands and idle connections, including a list of the files locked by the command for any duration, with lock wait times included in the lock information.

    Using the monitor level to display information about locked files has a non-trivial impact on performance; the monitor.lsof option is preferred for Unix platforms.

You can use the -z tag option with this option. In that case, the p4 monitor show command will return one lockinfo tag for each file that the process has locked.

-s status

Restrict the display to processes in the Running, Terminated, Paused, or Idle states.


See “Global Options”.

Usage Notes

Can File Arguments Use Revision Specifier?

Can File Arguments Use Revision Range?

Minimal Access Level Required



list, super

  • If a command terminates prematurely on the server side, it may be erroneously listed as running. Superusers can clear such processes with p4 monitor clear.

  • Some commands (for instance, p4 submit) invoke multiple processes. For example, dm_CommitSubmit or dm_SubmitChange may appear in the output of p4 monitor as two separate phases of the p4 submit command.

  • If you have enabled idle process monitoring (by setting the monitor configurable to 2), idle processes appear with a status of R, but with a command of IDLE.


p4 monitor show

Show Perforce processes information (commands only). Requires list access only.

p4 monitor show -l

Show arguments and commands, without limits on line length. Requires super access.

p4 monitor show -a

Show arguments and commands, limited to 80 characters per line of output. Requires super access.

p4 monitor terminate 123

Instruct the Perforce service to mark process 123 for termination. Requires super access.

p4 monitor clear all

Clears the monitor table of all entries. Requires super access.

Related Commands

To turn on monitoring

p4 configure set monitor=1

To turn off monitoring

p4 configure set monitor=0