21 Command line usage
ZHAO Xudong edited this page 2026-01-21 18:44:29 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Command line usage / 命令行使用

Language / 语言: English | 中文


English

Command line usage

Usage: electerm [options] sshServer


### Connect ssh server from command line examples:
- electerm user@xx.com
- electerm user@xx.com:22
- electerm --password password --set-env "SECRET=xxx USER=hhhh" user@xx.com:22
- electerm -l user -P 22 -i /path/to/private-key -pw password xx.com -T -t "XX
Server"

### Other params examples:

- server port:
electerm -sp 30976

- load and run batch operation from csv file:
electerm -bo "/home/root/works.csv"

### other connection types

- telnet: electerm -tp "telnet" -opts '{"host":"192.168.1.1","port":21","username":"root","password":"123456"}'
- rdp: electerm -tp "rdp" -opts '{"host":"192.168.1.1","port":3389","username":"root","password":"123456"}'
- vnc: electerm -tp "vnc" -opts '{"host":"192.168.1.1","port":3389","username":"root","password":"123456"}'
- serial: electerm -tp "serial" -opts '{"port":"COM1","baudRate":115200,"dataBits":8,"stopBits":1,"parity":"none"}'
- local: electerm -tp "local" -opts '{"title": "local terminal"}'
- ssh: electerm -tp "ssh" -opts '{"title": "some ssh","host": "192.168.1.5","username": "xxx","password": "yyyy","runScripts": [{"script": "cd xxx", "delay": 100}]}'

Options:
  -V, --version                    output the version number
  -t, --title [Tab Name]           Specify the title of the new tab
  -l, --user <user>                specify a login name
  -P, --port <port>                specify ssh port
  -bo, --batch-op <batchOpFile>    load and run batch operation from csv file
  -sp, --server-port <serverPort>  specify server port, default is
  -i, --private-key-path <path>    specify an SSH private key path
  -ps, --passphrase <passphrase>   specify an SSH private key passphrase
  -pw, --password <password>       specify ssh server password
  -se, --set-env <setEnv>          specify envs
  -so, --sftp-only <sftpOnly>      only show sftp panel
  -d, --init-folder <initFolder>   init folder got init terminal
  -h, --help                       display help for command

Other opts can be used:

{
  "title": "arm-dev",
  "color": "#e99695",
  "host": "192.168.2.21",
  "username": "execapp",
  "authType": "password",
  "password": "some-pass",
  "port": 22,
  "runScripts": [
    {}
  ],
  "encode": "utf-8",
  "enableSsh": true,
  "enableSftp": true,
  "envLang": "en_US.UTF-8",
  "term": "xterm-256color",
  "displayRaw": false,
  "cipher": [],
  "serverHostKey": [],
  "terminalBackground": {
    "terminalBackgroundImagePath": "",
    "terminalBackgroundFilterOpacity": 1,
    "terminalBackgroundFilterBlur": 0,
    "terminalBackgroundFilterBrightness": 1,
    "terminalBackgroundFilterGrayscale": 0,
    "terminalBackgroundFilterContrast": 1
  },
  "sshTunnels": [],
  "connectionHoppings": [],
  "proxy": "",
  "sshTunnelResults": []
};

Electerm Environment Variables

Proxy Settings

Electerm supports the following proxy-related environment variables:

ELECTRON_NO_PROXY_SERVER

When set, this variable tells Electerm not to use a proxy server and to connect directly to the network.

Example:

ELECTRON_NO_PROXY_SERVER=1 npm start

ELECTRON_PROXY_BYPASS_LIST

A comma-separated list of hostnames that should bypass the proxy server.

Example:

ELECTRON_PROXY_BYPASS_LIST="localhost,127.0.0.1" electerm

ELECTRON_PROXY_PAC_URL

The URL of a Proxy Auto-Configuration (PAC) file.

Example:

ELECTRON_PROXY_PAC_URL="http://example.com/proxy.pac" electerm

ELECTRON_PROXY_SERVER

The URL of the proxy server to use.

Example:

ELECTRON_PROXY_SERVER="http://proxy.example.com:8080" electerm

Database Path

DATA_PATH

This variable allows you to specify a custom path for the Electerm data.

Example:

DATA_PATH="/path/to/custom/data-folder" electerm

By default, if DB_PATH is not set, Electerm will use its default database location.

Using Multiple Environment Variables

You can use multiple environment variables together:

ELECTRON_PROXY_SERVER="http://proxy.example.com:8080" DB_PATH="/path/to/custom/database" electerm

This command starts Electerm with a custom proxy server and a custom database path.

中文

命令行使用

Usage: electerm [options] sshServer


### 从命令行连接 SSH 服务器示例:
- electerm user@xx.com
- electerm user@xx.com:22
- electerm --password password --set-env "SECRET=xxx USER=hhhh" user@xx.com:22
- electerm -l user -P 22 -i /path/to/private-key -pw password xx.com -T -t "XX
Server"

### 其他参数示例:

- 服务器端口:
electerm -sp 30976

- 从 CSV 文件加载并运行批量操作:
electerm -bo "/home/root/works.csv"

### 其他连接类型

- telnet: electerm -tp "telnet" -opts '{"host":"192.168.1.1","port":21","username":"root","password":"123456"}'
- rdp: electerm -tp "rdp" -opts '{"host":"192.168.1.1","port":3389","username":"root","password":"123456"}'
- vnc: electerm -tp "vnc" -opts '{"host":"192.168.1.1","port":3389","username":"root","password":"123456"}'
- serial: electerm -tp "serial" -opts '{"port":"COM1","baudRate":115200,"dataBits":8,"stopBits":1,"parity":"none"}'
- local: electerm -tp "local" -opts '{"title": "local terminal"}'
- ssh: electerm -tp "ssh" -opts '{"title": "some ssh","host": "192.168.1.5","username": "xxx","password": "yyyy","runScripts": [{"script": "cd xxx", "delay": 100}]}'

选项:
  -V, --version                    输出版本号
  -t, --title [Tab Name]           指定新标签的标题
  -l, --user <user>                指定登录名
  -P, --port <port>                指定 SSH 端口
  -bo, --batch-op <batchOpFile>    从 CSV 文件加载并运行批量操作
  -sp, --server-port <serverPort>  指定服务器端口,默认是
  -i, --private-key-path <path>    指定 SSH 私钥路径
  -ps, --passphrase <passphrase>   指定 SSH 私钥密码
  -pw, --password <password>       指定 SSH 服务器密码
  -se, --set-env <setEnv>          指定环境变量
  -so, --sftp-only <sftpOnly>      仅显示 SFTP 面板
  -d, --init-folder <initFolder>   初始化终端的文件夹
  -h, --help                       显示命令帮助

其他选项可以使用:

{
  "title": "arm-dev",
  "color": "#e99695",
  "host": "192.168.2.21",
  "username": "execapp",
  "authType": "password",
  "password": "some-pass",
  "port": 22,
  "runScripts": [
    {}
  ],
  "encode": "utf-8",
  "enableSsh": true,
  "enableSftp": true,
  "envLang": "en_US.UTF-8",
  "term": "xterm-256color",
  "displayRaw": false,
  "cipher": [],
  "serverHostKey": [],
  "terminalBackground": {
    "terminalBackgroundImagePath": "",
    "terminalBackgroundFilterOpacity": 1,
    "terminalBackgroundFilterBlur": 0,
    "terminalBackgroundFilterBrightness": 1,
    "terminalBackgroundFilterGrayscale": 0,
    "terminalBackgroundFilterContrast": 1
  },
  "sshTunnels": [],
  "connectionHoppings": [],
  "proxy": "",
  "sshTunnelResults": []
};

Electerm 环境变量

代理设置

Electerm 支持以下代理相关的环境变量:

ELECTRON_NO_PROXY_SERVER

当设置时,此变量告诉 Electerm 不使用代理服务器,直接连接网络。

示例:

ELECTRON_NO_PROXY_SERVER=1 npm start

ELECTRON_PROXY_BYPASS_LIST

用逗号分隔的主机名列表,应绕过代理服务器。

示例:

ELECTRON_PROXY_BYPASS_LIST="localhost,127.0.0.1" electerm

ELECTRON_PROXY_PAC_URL

代理自动配置 (PAC) 文件的 URL。

示例:

ELECTRON_PROXY_PAC_URL="http://example.com/proxy.pac" electerm

ELECTRON_PROXY_SERVER

要使用的代理服务器的 URL。

示例:

ELECTRON_PROXY_SERVER="http://proxy.example.com:8080" electerm

数据库路径

DATA_PATH

此变量允许您为 Electerm 数据指定自定义路径。

示例:

DATA_PATH="/path/to/custom/data-folder" electerm

默认情况下,如果 DB_PATH 未设置Electerm 将使用其默认数据库位置。

使用多个环境变量

您可以一起使用多个环境变量:

ELECTRON_PROXY_SERVER="http://proxy.example.com:8080" DB_PATH="/path/to/custom/database" electerm

此命令使用自定义代理服务器和自定义数据库路径启动 Electerm。