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

P4 CLI Documentation | 2026.1

# Use config files

Config files are text files containing settings that are in effect for files in and below the directory where the config file resides. Config files are useful if you have multiple client workspaces on the same computer. By specifying the settings in config files, you avoid the inconvenience of changing system settings every time you want to work with a different workspace.

To use config files, you define the `P4CONFIG` environment variable, specifying a file name (for example, `.p4config`). When you issue a command, P4 Server searches the current working directory and its parent directories for the specified file and uses the settings it contains (unless the settings are overridden by command-line options).

Each setting in the file must be specified on its own line, using the following format:

``setting`=`value``

Make sure there are no spaces. For example, ``setting` = `value`` will not work.

The following settings can be specified in a config file:

Setting | Description
--- | ---
`P4CHARSET` | Character set used for translation of Unicode files.
`P4COMMANDCHARSET` | Non-UTF-16 or UTF-32 character set used by Command-Line Client when `P4CHARSET` is set to a UTF-16 or UTF-32 character set.
`P4CLIENT` | Name of the current client workspace.
`P4DIFF` | The name and location of the diff program used by `p4 resolve` and `p4 diff`.
`P4EDITOR` | The editor invoked by those P4 Server commands that use forms.
`P4HOST` | Hostname of the client computer. Only useful if the `Host` field of the current client workspace has been set in the `p4 client` form.
`P4IGNORE` | A list of files to ignore when using the `p4 add` and `p4 reconcile` commands.
`P4LANGUAGE` | This environment variable is reserved for system integrators.
`P4MERGE` | The name and location of the third-party merge program to be used by `p4 resolve`'s merge option.
`P4PASSWD` | Supplies the current P4 Server user’s password for any P4 Server command.
`P4PORT` | The protocol, host and port number of the P4 Server (including proxies or brokers) with which to communicate.
`P4TRUST` | The location of a file of known (trusted) P4 Server. You manage the contents of this file with the `p4 trust` command. By default, this file is `.p4trust` in your home directory.
`P4USER` | Current P4 Server user name.

To learn more, see Environment and registry variables.

Example: Using config files to handle switching between two workspaces

Ona switches between two workspaces on the same computer. The first workspace is `ona-ash`. It has a client root of `/tmp/user/ona` and connects to the P4 Server using SSL/TLS at `ssl:ida:1818`. The second workspace is called `ona-agave`. Its client root is `/home/ona/p4-ona`, and it uses a plaintext connection to a P4 Server at `tcp:warhol:1666`.

Ona sets the `P4CONFIG` environment variable to `.p4settings`. She creates a file called `.p4settings` in `/tmp/user/ona` containing the following text:

    P4PORT=ssl:ida:1818
    P4CLIENT=ona-ash

She creates a second `.p4settings` file in `/home/ona/p4-ona`. It contains the following text:

    P4PORT=tcp:warhol:1666
    P4CLIENT=ona-agave

Any work she does on files under `/tmp/user/ona` is managed by the P4 Server at `ssl:ida:1818` and work she does on files under `/home/ona/p4-ona` is managed by the P4 Server at `tcp:warhol:1666`.

Your search for returned results