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

P4 CLI Documentation | 2026.1

# Define a command alias

Command aliases are defined in an alias file. You must have an alias file before you can define any aliases.

There are many reasons why it might be useful to define an alias:

- To use commands in a language other than English.

- To use commands that are familiar to you from other version control systems.

- To use different defaults.

- To streamline system administration.

- To use different output formats.

## Create an alias file

On Unix and Max systems, create a file named `.p4aliases` in your `$HOME` directory.

On Windows, create a file named `p4aliases.txt` in your `$USERPROFILE` directory.

If you do not put the alias file in the home directory, you must define the `P4ALIASES` environment variable to specify the location of the alias file.

The alias file can:

- Contain blank lines, but they will be ignored.

- Contain comment lines. A comment line begins with `#` as the first non-blank character.

- Be edited as often as you like to add, modify, or delete alias definitions.

## Define an alias

To define an alias, add a definition to the alias file and save the file.

For example, the following definition creates the alias me for the command set P4USER:

    me = set P4USER

To learn more about alias syntax, see Command alias syntax. For more examples of alias definitions, see Basic examples and Complex examples.

Run p4 aliases to get a listing of all currently defined aliases.

The server processes aliases in the order they have been defined, going through each one until it finds one that modifies the current command. It then restarts from the beginning, rechecking each alias. This means that a given command might be transformed more than once before it is run, depending on the aliases that use the command.

## Preview an alias

To preview the effect of an alias, run the following:

    p4 --aliases=dry-run <your-alias>

where <your-alias> is the alias you want to preview.

The output will show the command that would have run, but will not actually run it. For more information, see Preview alias substitutions.

## Run an alias

To run an alias, insert it in place of the command in its definition. For example, if you have defined the alias me = set P4USER, run:

    p4 me

This produces the same output as:

    p4 set P4USER

Your search for returned results