Menu PIA Support Portal
  • JOIN NOW
  • PIA Support Portal
    • How It Works
    • Download
    • Support
    • My Account
    • JOIN NOW

    How can we help?

      SUPPORT PORTAL
    • Knowledgebase Read help articles
    • Guides Product documentation
    • News News & updates
    • Contact Us We are here to help
    • PIA WEBSITE
    • How It Works
    • Download
    • Support
    • My Account



    • Portal
    • Knowledgebase
    • Technical
    • Application Settings and Features
    • Application & Features
    • PIA Desktop: Command Line Interface
    Subscribe Download PDF

    PIA Desktop: Command Line Interface

    Kaneesha D.
    2019-11-13
    in Application & Features

    The Private Internet Access desktop client includes a command-line interface that can be used to control some functionality of the PIA client from scripts.

    Invoking piactl


    Windows

    On Windows, specify the full path to piactl.exe or change into the PIA installation directory and invoke it.  For example:

    "C:\Program Files\Private Internet Access\piactl.exe" --help
    "C:\Program Files\Private Internet Access\piactl.exe" connect

    Or:

    cd "C:\Program Files\Private Internet Access"
    piactl --help
    piactl connect

    We do not recommend adding the PIA installation directory to PATH on Windows, as this would also add the DLLs shipped by PIA to PATH.

    The rest of this article will use piactl in example commands, substitute the full path on Windows as needed.


    Mac and Linux

    On Mac and Linux, piactl is symlinked into /usr/local/bin at installation time if possible, so normally piactl is sufficient from a command line.  For example:

    piactl --help
    piactl connect

    This requires that:

    • There isn't already a file called piactl in /usr/local/bin
    • /usr/local/bin is already in your PATH (PIA does not alter PATH)
    • On Linux, the directory /usr/local/bin must already exist.

    Otherwise, the full path to piactl can be used - on Mac: /Applications/Private Internet Access.app/Contents/MacOS/piactl; on Linux: /opt/piavpn/bin/piactl.

    Help

    piactl --help displays usage information.

    Usage: piactl [options] command [parameters...]
    Command-line interface to the PIA client. Some commands, such as connect, require that the graphical client is also running.

    Options:
     --timeout, -t <seconds> Sets timeout for one-shot commands.
     --debug, -d Prints debug logs to stderr.
     --help, -h Displays this help.
     -v, --version Displays version information.

    Arguments:
     command Command to execute
     parameters Parameters for the command

    Commands:
     connect
     Connects to the VPN, or reconnects to apply new settings.
     The PIA client must be running to use this command.
     (The PIA daemon is inactive when the client is not running.)
       
     disconnect
     Disconnects from the VPN.

     get
     usage: get <type>
     Get information from the PIA daemon.
     Available types:
     - debuglogging - State of debug logging setting
     - portforward - Forwarded port number if available, or the status of the request to forward a port
     - region - Currently selected region (or "auto")
     - regions - List all available regions
     - vpnip - Current VPN IP address

     resetsettings
     Resets settings to the defaults.

     set
     usage: set <type> <value>
     Change settings in the PIA daemon.
     Available types:
     - debuglogging - Enable or disable debug logging.
          - region - Select a region (or "auto")


    Options

    These options control general behavior of piactl.

    OptionDescription
    --timeout <sec> / -t <sec>Specifies the timeout used for one-shot commands (default is 5 seconds).  If the PIA daemon doesn't respond before this timeout, piactl exits unsuccessfully.
    --debug / -dDisplays debug output while executing piactl.
    --help / -hDisplays the help text.
    --version / -vDisplays the version of piactl.


    Commands

    piactl supports several commands:

    CommandDescription
    connectCauses PIA to connect to the VPN, if it isn't already connected.
    disconnectCauses PIA to disconnect from the VPN, if it is connected.
    get <type>Gets information about PIA settings or state.
    resetsettingsResets settings to the defaults.  This only resets daemon settings (those that control the VPN connection), like protocols, ports, exclusions, etc.  Graphical client settings (like the window type and icon theme) are not affected.
    set <type> <value>Sets some of the values obtainable with get.


    The PIA client must be running to use the connect command.  Otherwise, piactl will print a message and exit.  This is currently required because the daemon is inactive when the graphical client is not running, and so the daemon can disconnect if the user logs out.


    get/set types

    TypeCan set?DescriptionValues
    debugloggingYesWhether debug logging is enabledtrue or false
    portforwardNoWhen connected, the forwarded port, or the status of the request to forward a portForwarded port value, or state indicator: Inactive, Attempting, Failed, Unavailable
    regionYesThe current selected regionRegion identifier (see get regions) or auto for automatic region
    regionsNoLists all available regionsLists auto and all region identifiers
    vpnipNoThe current VPN IP address, if connected and the address is knownIP address, or Unknown
    • Tags
    • Command Line Interface

    Quick Jump
    • PIA Support Portal
    • Knowledgebase
    • Guides
    • News
    • Downloads
    • Contact Us
    Top

    Why

    • Hide My IP
    • Browse Anonymously
    • Public Wifi Security
    • Identity Protection
    • Internet Security
    • Internet of Things Security
    • Prevent Data Theft
    • Hide My Location
    • FaceNiff and Firesheep
    • Tor vs VPN vs Proxy
    • Free vs. Paid VPN
    • UN Recommends Encryption
    • Snooper's Charter
    • WiFi KRACK
    • Privacy from your ISP

    Service

    • How It Works
    • Buy VPN
    • VPN Encryption
    • Downloads
    • Network
    • Android VPN App
    • iOS VPN App

    Company

    • About Us
    • PIA Team
    • Jobs
    • Press Area
    • PIA In The Media
    • PIA On The Web
    • VPN Reviews
    • Companies We Support

    Resources

    • Contact Us
    • Support Portal
    • Tutorials
    • Blog
    • Whitehat Program
    • Affiliates
    • PIA Site Map

    Tools

    • DNS Leak Test
    • IPv6 Leak Test
    • Email Leak Test
    • What's my IP?

    About

    Private Internet Access is the leading VPN Service provider specializing in secure, encrypted VPN tunnels which create several layers of privacy and security providing you safety on the internet. Our service is backed by multiple gateways worldwide with access in 30+ countries, 50+ regions.

    Connect with us

    Payment Methods

    Copyright © London Trust Media, Inc. All Rights Reserved.
    • Terms Of Service
    • Privacy Policy
    • Cookies Policy
    • DMCA Policy
    • Export Control Policy

    Map data provided by OpenStreetMaps.

    PC Mag Editor’s Choice award image reprinted with permission. © 2012 Ziff Davis, Inc. All Rights Reserved.

    PC Mag quote reprinted from www.pcmag.com with permission. © 2012 Ziff Davis, Inc. All Rights Reserved.