Tech Monger

Programming, Web Development and Computer Science.

Skip to main content| Skip to information by topic

How to use Localtunnel - Options & Examples

In this post we will discuss all possible command line options supported by localtunnel with examples. Localtunnel is npm package and does not have man page of it's own. However you can check options by --help. Read this simple explanation below if some of it's features seems obscuring to you. If you have not already installed localtunnel then read previous post to install localtunnel and get your web server online with minimalistic setup.

Localtunnel Client (lt) Options

Flag Alias Explanation
-p --port Specify port number on which your local web server is running. Only this option is mandatory.
-s --subdomain Specify subdomain for you application. By default localtunnel would grant random domain name.
-o --open Opens created subdomain in default web browser.
-h --host If you have installed localtunnel server of your own then specify hostname of that server. By default application would run on localtunnel.me.
-l --local-host By default localtunnel server would assume that web server is hosted on localhost however you can override that value by specifying hostname or ip address of web server here.
--version Check version of localtunnel client.
--help Localtunnel client option help page.

Localtunnel Client lt Examples

This examples assume that you have hosted web server running on localhost port 5000.

-pCreate localtunnel on port 5000. Below command would output url with random subdomain where application will be running.

lt -p 5000

-sCreate localtunnel on port 5000 with specific subdomain (mytunnel).

lt -p 5000 -s mytunnel

-oCreate localtunnel on port 5000 with specific subdomain (mytunnel) and open application in browser.

lt -p 5000 -s mytunnel -o

-hIf you have hosted your own localtunnel server then you can specify server ip or name (www.example.com) to start tunnel.

lt -p 5000 -s owntunnel -h www.example.com

-lIf your web app is hosted on some other server than home computer then you can start tunnel from your computer but tunnel it to your web application instead of localhost like below.

lt -p 80 -l www.example.com

Above command assumes that you have web application running on www.example.com on port 80.
Note that if you execute above command then it should give you mirror of www.example.com on localtunnel.

--versionCheck localtunnel version

lt --version

--helpCheck localtunnel options

lt --help

Tagged Under : Linux Localtunnel Open Source Ubuntu Web Windows