The Private Internet Access (PIA) desktop app includes a command-line interface (CLI) called piactl. It allows you to control the PIA app, automate common tasks, and retrieve connection information from scripts or the terminal.
Note: Some commands require the PIA desktop app to be running.
Jump To…
How to Use PIA Through CLI
You can run PIA from Command Prompt, PowerShell, or a terminal, depending on your operating system.
Windows
To use the piactl command, open Command Prompt or PowerShell, then run piactl.exe from the PIA installation directory. For example:
"C:\Program Files\Private Internet Access\piactl.exe" connect
Alternatively, navigate to the PIA installation directory before running piactl. This lets you use piactl commands without entering the full file path each time. For example:
cd "C:\Program Files\Private Internet Access"
Once inside the folder, type the following to connect:
piactl connect
Note: We don't recommend adding the PIA installation directory to your system PATH. The folder contains files used by the PIA app, and making them available system-wide may interfere with other applications.
macOS and Linux
On macOS and Linux, piactl is available from the terminal after installing the PIA app.
Once installed, you can connect by typing the following into the terminal:
piactl connect
If you get an error, use the full path:
macOS:
/Applications/Private Internet Access.app/Contents/MacOS/piactl
Linux:
/opt/piavpn/bin/piactl
Common Commands
| Command | Description |
| piactl --help | Display all available commands and options. |
| piactl connect | Connect to the VPN. |
| piactl disconnect | Disconnect from the VPN. |
| piactl logout | Log out of the current PIA account. |
| piactl get connectionstate | Display the current VPN connection status. |
| piactl get vpnip | Display your current VPN IP address. |
| piactl get region | Show the selected VPN region. |
| piactl get regions | List all available VPN regions. |
| piactl set region <region> | Change the selected VPN region. |
| piactl monitor <type> | Continuously monitor a setting or connection state. |
| piactl resetsettings | Restore VPN-related settings to their defaults. |
Tip: For automated logins or scripts, store your credentials in a text file with your username on the first line and your password on the second line. Then run:
piactl login <credentials-file.txt>
This avoids exposing your credentials directly on the command line.