跳至主要内容

How to use the Mullvad CLI

Mullvad app Windows Linux macOS Desktop Feature Command Line Interface 

上次更新:

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

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

Split tunneling (Windows)

Check if Split tunneling is enabled or disabled:

mullvad split-tunnel get

Enable split tunneling:

mullvad split-tunnel set on

Disable split tunneling:

mullvad split-tunnel set off

List excluded apps:

mullvad split-tunnel get

Remove all excluded apps:

mullvad split-tunnel app clear

Exclude an app:

mullvad split-tunnel app add "C:\Program Files\Mozilla Firefox\firefox.exe"

Remove an excluded app:

mullvad split-tunnel app remove "C:\Program Files\Mozilla Firefox\firefox.exe"

DNS content blockers

To enable DNS filtering you can use the following commands.

To view the help, use this command.

mullvad dns set default --help

To enable all DNS filters except social media, use the following command.

mullvad dns set default --block-ads --block-trackers --block-malware --block-gambling --block-adult-content

To turn off all the content blockers use this command.

mullvad dns set default

Use custom DNS server

If you set a custom DNS server then it will override the DNS content blockers. You can only use a public DNS server if you use WireGuard protocol, but you can use a local DNS server with OpenVPN protocol.

To set a custom DNS server use the following command and replace 1.1.1.1 with the server IP you want to use.

mullvad dns set custom 1.1.1.1

To reset the DNS use this command.

mullvad dns set default

Use Bridge mode (OpenVPN)

To enable Bridge mode (using Shadowsocks proxies) use the following commands.

mullvad relay set tunnel-protocol openvpn

mullvad relay set tunnel openvpn --transport-protocol tcp

mullvad bridge set state on

To select a specific bridge server use this command.

mullvad bridge set location se mma se-mma-br-001

To set the location back to automatic use this command.

mullvad bridge set location any

To set Bridge mode back to automatic use these commands.

mullvad bridge set state auto

mullvad relay set tunnel openvpn --transport-protocol any

mullvad relay set tunnel-protocol any

Make custom server lists

To view the custom list options use this command.

mullvad custom-list

To create a new custom list named "Favorites" use this command.

mullvad custom-list new Favorites

To add a specific server, city or country to the list use one of these commands.

mullvad custom-list edit add Favorites se-mma-wg-001

mullvad custom-list edit add Favorites se got

mullvad custom-list edit add Favorites se

To select your custom list so you can connect to it, use this command.

mullvad relay set custom-list Favorites

To remove a specific server,city or country from the list use one of these commands.

mullvad custom-list edit remove Favorites se-mma-wg-001

mullvad custom-list edit remove Favorites se got

mullvad custom-list edit remove Favorites se

To rename a custom list use this command.

mullvad custom-list edit rename Favorites Favourites

To list all your custom lists and their content use this command.

mullvad custom-list list

To delete a custom list use this command.

mullvad custom-list delete Favourites

Report a problem

First create an anonymized log file.

mullvad-problem-report collect --output report.log

Before sending it to us, you have the option to view the log file.

Then send the log file.

mullvad-problem-report send --report report.log --email your@email.address --message "Write a description of your problem."

Although optional, we strongly recommend that you include a description of the problem. You also don't need to fill in an email address, but if you want a reply from us, you will need to include one.

Reset settings

This command performs a factory reset on all settings, deletes app logs and cache files, disconnects the app, and logs you out.

mullvad factory-reset

You will be asked to confirm your decision before the reset.