Credit: Lucas Gouveia/How-To Geek
Published 8 minutes ago
Faisal Rasool has been a feature writer at How-to Geek since early 2024. He brings five years of professional experience in simplifying technology for his readers on topics like mobile devices, PCs, and online privacy. He tries to help people get the most out of their gadgets and software with the least effort.
In his teenage years, he spent hours every day tinkering with Android phones and Linux builds. Faisal started his career at WhatMobile in 2019 (mostly out of his obsession with Android) where he published over 2,000 news stories. Currently, he contributes to the news section over at AndroidHeadlines.
He also authored more than 100 feature articles for SlashGear, covering Android, iOS, Web, Chromebooks, online priv…
Credit: Lucas Gouveia/How-To Geek
Published 8 minutes ago
Faisal Rasool has been a feature writer at How-to Geek since early 2024. He brings five years of professional experience in simplifying technology for his readers on topics like mobile devices, PCs, and online privacy. He tries to help people get the most out of their gadgets and software with the least effort.
In his teenage years, he spent hours every day tinkering with Android phones and Linux builds. Faisal started his career at WhatMobile in 2019 (mostly out of his obsession with Android) where he published over 2,000 news stories. Currently, he contributes to the news section over at AndroidHeadlines.
He also authored more than 100 feature articles for SlashGear, covering Android, iOS, Web, Chromebooks, online privacy/security, and PC content.
Faisal is also pursuing a Bachelor’s in English literature to build up his writing chops. He enjoys watercolors, classic video games, animated films, and conversations with strangers.
Summary
- CLI VPNs connect instantly and use fewer resources than GUI apps.
- Bind global shortcuts (e.g., F11/F12) to warp-cli connect/disconnect for one-key control.
- Enable warp service on boot and add warp-cli connect to autostart for always-on VPN.
If there’s one kind of app where the GUI gets in the way of functionality, it’s a VPN interface. That’s why the command-line interface is my favorite way of launching and interacting with a VPN app. It’s always faster, and doesn’t take up any extra resources. I started using a command-line VPN about a year ago, and I have not gone back to the GUI for VPN since.
Why command-line is better for VPN access
Normally, you first have to launch the VPN app, wait for it to load, click a toggle to enable VPN, and wait some more while it establishes a connection. With a CLI (command-line interface), this whole process boils down to a single command, which connects to the VPN almost instantly.
warp-cli connect
That’s the actual draw for me—just how fast it connects compared to a GUI toggle. Even if I’m moving between distros, I never have to bother finding where the system has placed the VPN toggle. I just open the terminal and connect or disconnect without ever opening the VPN interface itself.
On Linux systems, you can even bind keyboard shortcuts to execute commands. Basically, you can just press one key and execute a command in the background without opening the terminal or typing anything. That’s exactly how I’ve set up my CLI VPN. I’ve configured two shortcuts, one for connecting and one for disconnecting the VPN. I just press F11 to instantly connect to the VPN and F12 to disconnect. A GUI can never beat that speed.
Installing WARP-cli
The VPN I mostly use is the Cloudflare WARP 1.1.1.1 app. It’s not as feature-rich as popular VPN options like NordVPN, but it works for my purposes. You can install it too and follow along. Alternatively, you can install the VPN of your choice (for example, ProtonVPN or Mullvad) and drive them using the CLI. Most support CLI controls.
On Arch systems, you can install it using an AUR helper from the AUR.
yay -S cloudflare-warp-bin
On Debian or Ubuntu systems, you’ll have to manually add the official Cloudflare repo to install it using APT. Start by adding a GPG key, which the system uses to authenticate the packages.
curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg
The command should run without any error or output. Then add the Cloudlfare repo to your APT repos.
echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list
Now you need to update the lists to make sure APT can recognize this new repo we just added.
sudo apt update
We’re ready to install Cloudflare WARP.
sudo apt install cloudflare-warp
You can verify the installation by entering the following command. The app will show you a list of available options, if it’s installed correctly.
warp-cli
Setting up Warp-cli
Before we can connect to the WARP connection, we need to run a one-time setup in the terminal. To do that, enter the following command. When prompted, press ‘Y’ and hit Enter to confirm.
warp-cli registration new
Wait for the ‘success’ message.
If you’re using the premium WARP+ subscription, you will enter the license key at this step instead.
warp-cli registration license
We’re now ready to connect to the WARP connection. Run this command:
warp-cli connect
It should connect instantly. You can verify the connection by running the following command:
warp-cli status
Alternatively, you can launch a ‘curl’ command like this:
curl https://www.cloudflare.com/cdn-cgi/trace/
It’ll return a piece of text. Take note of where it says ‘warp=on,’ which means the connection is active. It’ll read ‘off’ if it’s not connected to the VPN.
To disconnect from the WARP connection, open the terminal and enter the following command.
warp-cli disconnect
You can verify the disconnection with the same command.
warp-cli status
Some pro tips
You can cut down the connection and disconnection speed even more by using a global shortcut to execute these two commands. Almost every popular Linux desktop environment has a GUI utility for adding shortcuts like those. For example, I’m on LXQt, and it has a ‘Shortcut Keys’ utility that lets me configure command-line shortcuts. KDE Plasma has ‘Application Shortcuts’ and GNOME lets you ‘create and customize shortcuts’ in the primary settings app.
Just click the ‘Add’ button, assign a shortcut key or a shortcut key combination, and enter the command. For example, I chose F11 as the shortcut to connect to the VPN and F12 to disconnect. You can use the keys or key combinations you like.
The WARP client can also be configured to automatically launch and connect on boot. That way you don’t even have to manually connect to the VPN connection. My Linux machine uses Systemd, so I’ll use the following command to launch the client on boot.
sudo systemctl enable --now warp-svc
The client will now launch and run in the background, but it won’t automatically connect. We’ll need to add a startup command to do that. Most Linux desktop environments come with utilities for managing startup applications. For example, LXQt has the Sessions Settings utility that lets you manage apps that autostart. It has an ‘Add’ button, where you give the job a name and enter the following command to autostart.
warp-cli connect
Your Linux system will now automatically connect to this VPN connection on boot. You can verify the connection at any point by running the following command:
warp-cli status
Linux makes it so much simpler to connect to VPN connections. Instead of relying on the standard GUI app, you can establish VPN connections with a quick console command. You can set up keyboard shortcuts to instantly connect or disconnect VPN connections. can even set up the PC to automatically connect to the VPN on boot and always stay on.