Skip to content

Lokal CLI Guide

Lokal CLI Guide

Lokal is a powerful command-line interface (CLI) tool that provides various networking functionalities. This guide will walk you through the usage of Lokal CLI and its subcommands.

Table of Contents

  1. Installation
  2. Basic Usage
  3. Subcommands

Installation

Please execute the command below on your Linux machine, sudo privileged may required for installation

Terminal window
curl -fsSLo- https://download.lokal.so/cli/install-cli.sh | bash

Basic Usage

The basic syntax for using Lokal CLI is:

Terminal window
lokal [subcommand] [options]

To display the program version:

Terminal window
lokal --version

To get help on available commands and options:

Terminal window
lokal --help

Subcommands

Lokal CLI offers several subcommands for different networking tasks:

HTTP

The http subcommand is used for HTTP-related operations.

Usage:

Terminal window
lokal http <local address> [options]

Options:

  • --lan-address: Assign a .local address to enable LAN-wide accessible address
  • --basic-auth: Enable basic authentication automatically before accessing your endpoint
  • --cidr-allow: Reject connections that do not match the given CIDRs
  • --cidr-deny: Reject connections that match the given CIDRs
  • --request-header-add: Add a header (key:value ) to the request
  • --request-header-remove: Remove a header field from the request if present
  • --response-header-add: Add or replace a header (key:value ) in the response
  • --response-header-remove: Remove a header field from the response if present
  • --domain: Specify a domain that has been used or registered on the tunnel server (e.g., custom.k.lokal-so.site)

TCP

The tcp subcommand is used for TCP-related operations.

Usage:

Terminal window
lokal tcp <local address> [options]

Options:

  • --domain: Specify a registered domain and port on the tunnel server (e.g., k.lokal-so.top:27837 or just k.lokal-so.top)

UDP

The udp subcommand is used for UDP-related operations.

Usage:

Terminal window
lokal udp <local address> [options]

Options:

  • --domain: Specify a registered domain and port on the tunnel server (e.g., k.lokal-so.top:27837 or just k.lokal-so.top)

Web

The web subcommand is used for web-related operations.

Usage:

Terminal window
lokal web [options]

Options:

  • --bind-address: Specify the bind address (defaults to the stored setting in the database)

License

The license subcommand is used to manage your Lokal.so license.

Usage:

Terminal window
lokal license <Lokal.so License Key>

Conclusion

This guide covers the basic usage of the Lokal CLI and its subcommands. For more detailed information on each subcommand and its options, use the --help flag with the specific subcommand (e.g., lokal http --help).