Command reference

View detailed information about commands available when interacting with a P4 Server. You can also run the p4 help command for information.

You can also view Commands by functions area, for Git repo commands, and restrictions for P4 Cloud commands.

A | B | C | D | E | F | G | H | I | J | K | L | M | O | P | R | S | T | U | V | W | Z

A

Command

Description

p4 add Open files in a client workspace for addition to the depot.
p4 add (graph) Open a new file to add it to the repo.
p4 admin Perform administrative operations on the server.
p4 aliases Display command aliases that are currently defined in a .p4aliases file.
p4 annotate Print file lines along with their revisions.
p4 archive Archive obsolete revisions to an archive depot.
p4 attribute Set per-revision attributes on revisions: name-value pairs that associate metadata with the file revision.

B

Command

Description

p4 bgtask Run background commands or triggers on the server.
p4 branch Create or edit a branch mapping and its view.
p4 branches List existing branch mappings.

C

Command

Description

p4 cachepurge Reclaim disk space on a replicated server.
p4 change Create or edit a changelist specification.

p4 changelist

This command is an alias for p4 change.
p4 changelists This command is an alias for p4 changes.
p4 changes List submitted and pending changelists.
p4 check-permission (graph) Check access permission granted to a user of a repo. This command is for graph depots only.
p4 clean Restore client workspace files to match the state of corresponding depot files.
p4 client Create or edit a client workspace specification and its view.
p4 client (graph) Create or edit a client workspace specification.
p4 clients List all client workspaces currently known to the system.
p4 clone Clone a new local P4 Server from a remote server.

p4 configure

Set, view, and manage server configuration variables, including comments.
p4 copy Copy files and/or the stream spec from one location in the depot to another.
p4 counter

Access, set, increment, or delete a persistent variable.

p4 counters Display the list of long-term variables used by P4 Server and associated scripts.
p4 cstat Dump change or sync status for the current client workspace.

D

Command

Description

p4 dbschema Report information about metadata in the database on the P4 Server.
p4 dbstat Display size or simple statistics for one or more database tables.
p4 dbverify Perform low-level verification of the database tables.
p4 delete Open files in a client workspace for deletion from the depot.
p4 delete (graph) Delete an existing file from the repo.
p4 depot Create, edit, or delete a depot specification.
p4 depots Display a list of depots known to the .P4 Server.

p4 describe

Provides information about changelists, as well as files in the changelists, and the path of the open stream, if a stream is open.
p4 describe (graph) Display a commit description.
p4 diagnostics Generate diagnostic data about the P4 Server.
p4 diff Diff utility for comparing workspace content to depot content. (For comparing two depot paths, see p4 diff2.) Also for stream spec comparison.

p4 diff (graph)

Diff utility for comparing workspace content to repo content. (For comparing two repo paths, see p4 diff2 (graph).)
p4 diff2 Diff utility for comparing the content at two depot paths. (For comparing workspace content to depot content, see p4 diff.)
p4 diff2 (graph) Diff utility for comparing the content at two repo paths. (For comparing workspace content to repo content, see p4 diff (graph).)
p4 dirs List the immediate subdirectories of the specified depot directories.
p4 dirs (graph) List repo subdirectories.

p4 diskspace

Display disk space information on the server.

E

Command

Description

p4 edit Opens files in a client workspace for edit, or open the current stream spec.
p4 edit (graph) Open an existing file for edit.
p4 export Extract journal or checkpoint records.

p4 extension

Create and configure P4 Extensions.

F

Command

Description

p4 failback After a failover with target server The immediately upstream server for replica servers, edge servers, standby servers, proxies and brokers. See also 'upstream server' and 'central server'. participation, fail back to restore the previous role of that target server.

p4 failover

Fail over to a standby server.
p4 fetch Copy files from a remote server into your local server.
p4 filelog Print detailed information about the revisions of files.
p4 filelog (graph) List the commit history of the specified file.
p4 files Provide information about files in the depot without accessing their contents.
p4 files (graph) List the files in thee repo.
p4 fix Link jobs to the changelists that fix them.
p4 fixes List jobs and the changelists that fix them.
p4 flush Update the have list The list of file revisions most recently synced from the depot into the workspace. In other words, the list of files that the client workspace has. of a client workspace without copying any files.
p4 fstat Dump file information in a tagged format that is suitable for parsing by scripts.
p4 fstat (graph) List file info.

G

Command

Description

p4 grant-permission (graph) Assign the specified permission for the specified depot of type graph (or a repo The container of files that the Git Connector caches or mirrors from Git users. See also 'graph depot'. in that graph depot A depot of type graph that is used to store Git repos managed by P4 Server. See also Git Connector and classic depot.) to the specified user or group.
p4 graph gc (graph) Delete records of orphaned objects from the object table.
p4 graph lfs-lock (graph) Create a git lfs-lock.

p4 graph lfs-locks (graph)

List the git lfs-locks in the repo.

p4 graph lfs-unlock (graph)

Remove a git lfs-lock.
p4 graph log (graph) List commits.
p4 graph purge-refhist (graph) Delete refhist records for a repo.
p4 graph rebase (graph) Replay local history onto the target's new base.
p4 graph recompute-refcnts (graph) Recompute object refcounts in the object table.
p4 graph show-ref (graph) Display reference values.
p4 graph tag (graph) Tag a commit with a name.
p4 graph tags (graph) List tagged commits in all repos.
p4 graph verify (graph) Verify repo integrity.
p4 grep Print lines in files (or revisions of files) that match a pattern.
p4 group Add or delete users from a group, or set limits for the members of a group.
p4 groups List groups of users.

H

Command

Description

p4 heartbeat Monitor the responsiveness of a target server, such as a standby server monitoring its target server The immediately upstream server for replica servers, edge servers, standby servers, proxies and brokers. See also 'upstream server' and 'central server'., to help the administrator determine if a failover might be needed.
p4 have List files and revisions that are synced to the client workspace.
p4 have (graph) List the commit most recently synced to the current workspace.
p4 help Provide command-line help for P4 Server.
p4 help-graph (graph) Provide on-line help for P4 Server commands for depots of type graph.
p4 hotfiles Edit the hotfiles mapping table for altsync client workspaces.

I

Command

Description

p4 ignores Displays the ignore mappings computed from the rules in P4IGNORE files.
p4 info Display information about the current P4 Server application and the shared versioning service.
p4 init Initializes a new P4 Server.
p4 integrate Open files and/or the stream spec for branching (noun) A set of related files that exist at a specific location in the P4 depot as a result of being copied to that location, as opposed to being added to that location. A group of related files is often referred to as a codeline. To associate code reviews in P4 Code Review (formerly Helix Swarm) with the projects they are part of, add the 'branch' paths in the P4 Code Reviewproject. (verb) To create a codeline by copying another codeline with the 'p4 integrate', 'p4 copy', or 'p4 populate' command. or merging.
p4 integrated Show integrations that have been submitted.
p4 interchanges Report changes not yet integrated.
p4 istat Check for integrations needed for stream files, the stream spec, or both.

J

Command

Description

p4 job Create or edit an instance of a job, such as a defect or enhancement request.
p4 jobs List jobs known to the P4 Server.
p4 jobspec Edit the jobs template to change, add, or remove spec fields for job forms.
p4 journalcopy Copies journal data from a target server The immediately upstream server for replica servers, edge servers, standby servers, proxies and brokers. See also 'upstream server' and 'central server'. to the local file system of a standby replica.
p4 journaldbchecksums Write journal notes with table checksums.
p4 journals Display history of checkpoint and journal activity for the server.

K

Command

Description

p4 key Display, set, or delete a key/value pair.
p4 keys Display list of known key/value pairs.

L

Command

Description

p4 label Create or edit a label specification and its view.
p4 labels Display the list of defined labels.
p4 labelsync Synchronize a label with the contents of the current client workspace.
p4 ldap

Create, display, edit, or delete an LDAP configuration specification, or test an existing LDAP configuration.

p4 ldaps Display a list of LDAP configurations or attempt to authenticate a user against active configurations.
p4 ldapsync Synchronize P4 Server users and group memberships with LDAP groups.
p4 license Update or display the license file.
p4 list Create a temporary list of files that can be used as a label.
p4 lock Lock an opened file against other users submitting changes to the file.
p4 lock (graph) Lock an opened file to prevent it from being submitted to the repo.
p4 lockstat Report lock status of database tables.
p4 logappend Add a line to any user log P4 Server supports the standard log, which is human-readable, as well as structured logs in a comma-separated value (CSV) format. The P4LOG environment variable specifies the log file for events, including errors. The human-readable P4AUDIT environment variable specifies the log file that records file transfers to users. Structured log files are typically processed by external tools. To learn more, see 'Logging" in P4 Server Administration Documentation. files.
p4 logexport Export a structured server log file to an external service using the OpenTelemetry Protocol (OTLP).
p4 logger Report changed jobs and changelists.
p4 login Log in to the P4 Server by obtaining a ticket.
p4 login2 Perform multi-factor authentication (MFA), formerly known as second factor authentication (2fa).
p4 logout Log out a user of the P4 Server by removing a ticket on the user’s workstation, or by invalidating the user's ticket on the server.
p4 logparse Parse a structured log file and return log data.
p4 logrotate Rotate one or more structured log P4 Server supports the standard log, which is human-readable, as well as structured logs in a comma-separated value (CSV) format. The P4LOG environment variable specifies the log file for events, including errors. The human-readable P4AUDIT environment variable specifies the log file that records file transfers to users. Structured log files are typically processed by external tools. To learn more, see 'Logging" in P4 Server Administration Documentation. files.
p4 logschema Describe the schema of structured log record types.
p4 logstat Report size of journal, error log, and/or audit log files, or report size of the specified structured file.
p4 logtail Display the last block(s) of the error log.

M

Command

Description

p4 merge Merge 1. To create new files from existing files, preserving their history when branching. 2. To propagate changes from one set of files to another. 3. The process of combining the contents of two conflicting file revisions into a single file, typically using a merge tool, such as P4 Merge. one set of files (and/or the stream spec) into another.
p4 merge (graph) Merge another branch into the current or target branch.
p4 monitor Display P4 Server process information and control long-running tasks.
p4 move Move (rename) a file from one location to another within the branch.

O

Command

Description

p4 obliterate Permanently removes files and their history (metadata) from the depot.
p4 opened List files that are open in pending changelists.
p4 opened (graph) Display the list of files opened in pending changelists.

P

Command

Description

p4 passwd Change the P4 Server password of a user.
p4 ping Test network performance.
p4 populate Branch (noun) A set of related files that exist at a specific location in the P4 depot as a result of being copied to that location, as opposed to being added to that location. A group of related files is often referred to as a codeline. To associate code reviews in P4 Code Review (formerly Helix Swarm) with the projects they are part of, add the 'branch' paths in the P4 Code Reviewproject. (verb) To create a codeline by copying another codeline with the 'p4 integrate', 'p4 copy', or 'p4 populate' command. a set of files as a one-step operation.
p4 print Print the contents of a depot file revision.
p4 print (graph) Write a repo file to standard output.
p4 property Add, delete, or list property values.
p4 protect Control user access to files, directories, and commands.
p4 protects Display protections in place for a given user, group, or path.
p4 proxy Display Proxy connection information.
p4 prune Removes unmodified files from a stream.
p4 pubkey (graph) Add, update, or delete an SSH public key on the P4 Server.
p4 pubkeys (graph) Display a list of the SSH public keys.
p4 pull Retrieve metadata or versioned files from a P4 Servertarget server The immediately upstream server for replica servers, edge servers, standby servers, proxies and brokers. See also 'upstream server' and 'central server'. to its standby or replica, or display status information about pending transfers. There is a special syntax for a commit server to pull from a replica. In most situations, server replication with p4 pull is preferable to p4 replicate.
p4 push Copy submitted files in your local server to a remote server.

R

Command

Description

p4 reconcile Open files for add, delete, or edit to reconcile a workspace with changes made outside of P4 Server. You might need to use this command after working offline from P4 Server.
p4 reconcile (graph) Open files for add, delete, or edit to reconcile a workspace with changes made outside of P4 Server.
p4 reload Reloads the specified workspace, label, or task stream from the unload depot.
p4 remote Create, modify or delete a remote specification.
p4 remotes Display a list of remote specifications.
p4 rename The command p4 rename is an alias for p4 move.
p4 renameclient Rename a client workspace.
p4 renameuser Rename a user and modify all database records that mention the user.
p4 reopen Move opened files between changelists or change the files' type, or move the client's stream spec to a different changelist.
p4 replicate Poll for journal changes on one P4 Server for forwarding to another P4 Server.
p4 repo (graph) Create, edit, or delete a repo specification.
p4 repos (graph) Display a list of repos.
p4 reshelve Copies shelved files from an existing shelf into either a new shelf or one that has already been created. This command does not require a client workspace.
p4 resolve Resolve conflicts between file revision, or resolve a stream spec conflict.
p4 resolve (graph) Resolve integrations and updates to repo workspace files.
p4 resolved Display a list of files that have been resolved but not yet submitted.

p4 restore

Restore old archived revisions from an archive depot.
p4 resubmit Resolve and resubmit some or all unsubmitted changes.
p4 revert Discard changes made to open files or revert an open stream spec.
p4 revert (graph) Discard changes from an opened file.
p4 review List and track changelists (for the review daemon).
p4 reviews List the users who are subscribed to review files.
p4 revoke-permission (graph) Remove from a user or group access to a depot of type graph or to a repo.

S

Command

Description

p4 server Create, modify, or delete a P4 Server specification.
p4 serverid Get or set the unique ID associated with a P4 Server.
p4 servers Display list of all server specifications or evaluate replication status.
p4 set View or set P4 variables used by P4 Server and client applications.
p4 shelve Store files (or a stream spec) from a pending changelist in the depot without submitting them.
p4 show-permission (graph) Display the permissions for the specified depot of type graph or a repo.
p4 show-permissions (graph) Display a user-centric view of the permissions for repo.
p4 show-ref (graph) Display reference values.
p4 sizes Display size information for files in the depot.
p4 status Previews output of open files for add, delete, and/or edit in order to reconcile a workspace with changes made outside of P4 Server.
p4 storage Display, verify, or update physical archive storage.

p4 stream

Create, edit, delete, or obliterate an instance of a stream An enhanced type of branch with a dedicated view for clients of the stream (see 'stream view') and built-in rules that determine how changes flow across the stream depot (see 'stream hierarchy'). A stream specification defines a stream. In P4V, stream specs are visible in the Streams Graph and the Streams tab. (also known as a stream definition or stream spec).
p4 streamlog List revision history of streams.
p4 streams Display a list of streams.
p4 streamspec Edit the streams template to change, add, or remove spec fields for stream forms.
p4 submit Submit a pending changelist and the files it contains to the depot, and/or submit an open stream spec.
p4 submit (graph) Commit open files to the repo.
p4 switch Create a stream, or switch to a different stream, with an option to populate that stream, or to display current streams.
p4 switch (graph) Switch to a different branch, or create a branch.
p4 sync Update the client workspace Directories on your machine where you work on file revisions that are managed by P4 Server. to reflect the contents of the depot A file repository hosted on the P4 Server. A depot is the top-level unit of storage for versioned files, which are also known as depot files, archive files, or source files. It contains all versions of all files ever submitted to the depot. Except for obliterated files, any version of any file can be restored, including deleted files, but not obliterated files. An installation can have multiple depots, and they might be of different types, such as a local depot and a stream depot..
p4 sync (graph) Synchronize the client workspace with its view of the repo.

T

Command

Description

p4 tag Tag files with a label
p4 tickets Display all tickets granted to a user by p4 login.
p4 topology Reports the P4 servers that are connected directly and indirectly to the innermost server, including an indicator of the server this command is running on.
p4 triggers Create or display a list of scripts to be run conditionally when certain operations are performed, such as changelist submitted, form updated, journal rotated, and more.
p4 trust Establish trust of an SSL/TLS connection to a Perforce service.
p4 typemap View or modify the file name-to-type mapping table.

U

Command

Description

p4 undo Undo a range of revisions.
p4 unload Unloads a workspace, label, or task stream to the unload depot or to a flat file.
p4 unlock Release the lock on one or more files.
p4 unlock (graph) Release a locked file, leaving it open.
p4 unshelve Retrieve shelved files and the stream spec from a pending change into a workspace.
p4 unsubmit Unsubmit a changelist, making it a shelved set of changes.
p4 unzip Import files from a p4 zip package file.
p4 update Update a client workspace without overwriting files that have changed since last sync.
p4 upgrades Show server upgrade status.
p4 user Create, edit, or delete P4 Server user specifications and preferences.
p4 users Print a list of all known users of the current Perforce service.

V

Command

Description

p4 verify Verify that the P4 Server archives (depot files) are intact (complete and without corruption).

W

Command

Description

p4 webserver Start or stop the P4 Web Server.
p4 where Show how the specified files are mapped by the client view.
p4 workspace The p4 workspace command is an alias for p4 client.
p4 workspaces The p4 workspaces command is an alias for p4 clients.

Z

Command

Description

p4 zip (DVCS) Package a set of files and their history for use by p4 unzip.