Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 CLI Documentation | 2025.2

# Command alias syntax

The definition of a command alias can be complex. This section describes the basic syntax for defining a command alias and introduces the elements that you can use in a definition. The sections that follow provide examples for defining complex aliases.

In its simplest form, the syntax for a command alias definition looks like this:

    alias = transformation

For example, you want to use French for a command name:

    fiches = files

Having included this definition in your alias file, you can now execute a command like `p4 fiches @2015/3/15`, and have the server list information about all file revisions in the depot as of March 15, 2015.

The alias can use arguments. In this case, the alias arguments are matched against the values the user provides in the transformation. The arguments in the transformation do not have to occur in the same order as they are shown in the alias. They are matched by name. Syntax for this definition looks like this:

    alias-name [[$(arg1)...[$(argn)]]= transformation

Syntax for the transformation can vary widely. Here is one possibility:

    command $(arg1) $(arg2) $(arg3)

For example:

    recent-changes $(max) = changes -m $(max)

The recent-changes alias might then be called as follows:

    $ p4 recent-changes 5

And the command would show the last five submitted changelists.

Alias definitions can contain the following elements:

- command arguments

- environment variables

  These include all P4 Server environment variables (for example, `P4USER`, `P4CLIENT`, `P4PORT`) as well as OS variables.

- input/output redirection
- special operators

The following table describes the special operators for use in command alias definitions:

Operator | Meaning
--- | ---
`$(`arg`)` | Specifies an alias argument in the alias and is matched with arguments in the transformation.
`#` | As the first non-blank character of a line, indicates a comment.
`&&` | Chain commands. See Limitations of chained commands for information about chaining commands.
`\` | Continue line (use to break up long lines when there are no new commands).
`<` | Take input from.
`>` | Send output to.
`$(EQ)` | Equal to.
`$(LT)` | Less than.
`$(GT)` | Greater than.
`p4subst` | String substitution, for example in editing specs. See Editing specifications.

Your search for returned results