Saltar al contenido principal

How to use the Mullvad CLI

Mullvad app Windows Linux macOS Desktop Feature Command Line Interface 

Actualizado por última vez:

Follow this guide to use the Mullvad command line interface (CLI) in the Terminal (Linux, macOS) or Command Prompt (Windows).

For more commands, see also the guide CLI commands for using WireGuard.

Requirements

If the Mullvad app isn't up to date, first download the latest version and install it.

What this guide covers

Basic commands

Open a terminal window and type mullvad to see a full list of subcommands and their usages. Below is a list of the most common ones.

Set your account

Replace the number string with your Mullvad account number.

mullvad account login 1234123412341234

Type mullvad account to see a list of other account-related commands.

Show account info

This command will show your account number, device name and the expiration date of your account.

mullvad account get

List device names in the account

mullvad account list-devices

List server locations

This command displays a list of available countries and cities.

mullvad relay list

Select a location

In this example, we are connecting to a server in Sweden (se), in the city of Malmö (mma).

Replace "se" with the country of your choice and, optionally, "mma" with a specific city in that country.

mullvad relay set location se mma

Select a specific server

Replace "se" with the country of your choice and, optionally, "mma" with a specific city in that country and "se-mma-001" with a servername in this group.

mullvad relay set location se mma se-mma-wg-001

Or use this command.

mullvad relay set location se-mma-wg-001

Connect

Connect to the location that you selected.

mullvad connect

Disconnect

mullvad disconnect

Force an update of the server location list

mullvad relay update

Check your connection status

mullvad status

To see more details use this command.

mullvad status -v

Use OpenVPN over TCP:

This can help if you are not able to connect with WireGuard or OpenVPN over UDP.

mullvad relay set tunnel-protocol openvpn

mullvad relay set tunnel openvpn --transport-protocol tcp

Auto-connect on start-up

If you want Mullvad to start and connect when you boot up your computer, use this command.

Note! This command does not affect the "Auto-connect" GUI setting. These settings are independent of each other.

mullvad auto-connect set on

To turn this off, run

mullvad auto-connect set off

Enable LAN access

mullvad lan set allow

Enable Lockdown mode

The kill switch activates automatically when you connect to Mullvad VPN. It makes sure that it won't leak your IP in case it loses the connection to the server or if you reconnect. However you can also enable Lockdown mode which will block all Internet traffic until you have connected to Mullvad. Use this command:

mullvad lockdown-mode set on

Enable in-tunnel IPv6

mullvad tunnel set ipv6 on

More commands

Split tunneling (Linux)

Split tunneling allows you to exclude some apps from the VPN so they will use your regular Internet connection. This will for example allow you to access some websites that are blocking VPN services.

Using mullvad-exclude

To start a new process excluded from Mullvad use this command.

mullvad-exclude <program>

Example: run a connection check outside of the VPN tunnel.

mullvad-exclude curl https://am.i.mullvad.net/connected

Using mullvad split-tunnel

This command works with the PID (process ID) of a program. To find the PID of a running program use the pgrep Linux command.

To exclude a process from Mullvad that is already running use this command.

mullvad split-tunnel add <pid>

To list the PIDs of all the processes that are currently excluded use this command.

mullvad split-tunnel list

To restore a previously excluded process use this command.

mullvad split-tunnel delete <pid>

To restore all previously excluded processes use this command.

mullvad split-tunnel clear