The Mullvad VPN command-line interface (CLI) provides full control over the VPN client through terminal commands. It’s ideal for automation, scripting, and advanced users who prefer terminal-based workflows.
# Show current connection statusmullvad status# Show status with detailed informationmullvad status -vmullvad status --verbose# Output status as JSONmullvad status --json
Example output:
SecuredConnected to se-got-wg-001IPv4: 10.68.124.45IPv6: fc00:bbbb:bbbb:bb01::3:7c2c
# List devices on accountmullvad account list-devices# Remove a devicemullvad account remove-device <device-id># Set device namemullvad account set-device-name "My Laptop"
# List all countriesmullvad relay list countries# List all cities in a countrymullvad relay list cities se # Sweden# List all servers in a citymullvad relay list servers se got # Gothenburg, Sweden
# Set specific countrymullvad relay set location se# Set specific citymullvad relay set location se got# Set specific servermullvad relay set location se got-wg-001# Use any servermullvad relay set location any
# Show current constraintsmullvad relay show# Set server by ownershipmullvad relay set ownership mullvad-ownedmullvad relay set ownership rentedmullvad relay set ownership any# Set server by providermullvad relay set provider 31173 # AS number
# Show current tunnel protocolmullvad tunnel show# Set WireGuard portmullvad tunnel wireguard port set 51820mullvad tunnel wireguard port set auto# Show WireGuard keymullvad tunnel wireguard key show# Rotate WireGuard keymullvad tunnel wireguard key rotate# Set custom MTUmullvad tunnel wireguard mtu set 1380mullvad tunnel wireguard mtu unset# Enable quantum-resistant tunnelmullvad tunnel wireguard quantum-resistant onmullvad tunnel wireguard quantum-resistant off
# Show obfuscation settingsmullvad anti-censorship show# Enable automatic obfuscationmullvad anti-censorship on# Disable obfuscationmullvad anti-censorship off# Set specific obfuscation protocolmullvad anti-censorship set protocol udp2tcpmullvad anti-censorship set protocol shadowsocks# Set obfuscation portmullvad anti-censorship set port automullvad anti-censorship set port 443
# Show current DNS settingsmullvad dns show# Set custom DNS server (through tunnel)mullvad dns set custom 1.1.1.1mullvad dns set custom 1.1.1.1 1.0.0.1 # Multiple servers# Use default DNS (VPN server)mullvad dns set default# Enable content blockingmullvad dns set blocking-options ads trackers malware# Disable content blockingmullvad dns unset blocking-options
# Enable lockdown mode (block traffic when disconnected)mullvad lockdown-mode on# Disable lockdown modemullvad lockdown-mode off# Show current settingmullvad lockdown-mode show
# Create custom listmullvad custom-list create "My Favorites"# Add location to listmullvad custom-list add "My Favorites" se got# Remove location from listmullvad custom-list remove "My Favorites" se got# List all custom listsmullvad custom-list list# Delete custom listmullvad custom-list delete "My Favorites"# Select relay from custom listmullvad relay set location "My Favorites"
#!/bin/bash# Connect to VPN when on public WiFiSSID=$(iwgetid -r)if [[ "$SSID" == "CoffeeShop" || "$SSID" == "Airport" ]]; then mullvad connect --wait echo "Connected to VPN on public network"fi
#!/bin/bash# Rotate to random server every hourwhile true; do # Select random country COUNTRY=$(mullvad relay list countries | shuf -n1) # Connect to random server in that country mullvad relay set location "$COUNTRY" mullvad reconnect --wait echo "Connected to $COUNTRY" sleep 3600done
#!/bin/bash# Test connection to different serversfor country in se de us; do echo "Testing $country..." mullvad relay set location "$country" mullvad reconnect --wait # Test speed (requires speedtest-cli) speedtest-cli --simple echo "---"done
# Check if CLI is in PATHwhich mullvad# Linux: Ensure installedapt list --installed | grep mullvad# macOS: Check installationls -l /usr/local/bin/mullvad# Windows: Check PATH includes Program Filesecho %PATH%