桌面 CLI

DR-Terminal 的桌面版本附带一个命令行界面。对于 IDE 集成、脚本编写和自动化很有用。

用法

DR-Terminal connect <target> [flags]

标志

标志说明
-u, --user用户名(用于 host:port 目标)。
-p, --password命令行上的密码(不安全 — 可能进入 shell 历史)。
--password-stdin从标准输入读取密码(安全:pass show server | DR-Terminal ...)。仅适用于 --exec
-i, --identity私钥文件(PEM)。仅适用于 --exec
-j, --jump按名称指定的跳板机链,例如 bastion1,bastion2
-c, --commandShell 代码片段:在登录后注入(默认)或使用 --exec 无界面执行。
--new-tab强制在运行中的实例里打开一个新标签页。
--exec无界面:运行命令,流式输出 stdout/stderr,并以远程退出码退出。
-h, --help显示此帮助。

-i--password-stdin 仅适用于无界面的 --exec 运行。在 GUI 中打开标签页时,认证使用已保存连接的凭据或常规的应用内提示。

示例

# Open a new tab in the running instance and log into saved "lager"
DR-Terminal connect lager --new-tab

# Ad-hoc host with user — the app prompts for credentials
DR-Terminal connect 10.0.0.1:22 -u pi --new-tab

# Jump chain: bastion1 → bastion2 → target
DR-Terminal connect production -j bastion1,bastion2 --new-tab

# Headless exec with a key file — prints uptime and exits
DR-Terminal connect 10.0.0.1:22 -u pi -i ~/.ssh/id_ed25519 --exec -c 'uptime'

# CLI start script: run commands after login
DR-Terminal connect dev --new-tab -c 'cd /srv/app && tmux attach -t main'

符号链接到 PATH

安装 DR-Terminal 后,创建一个符号链接,使该命令可全局使用:

sudo ln -s /path/to/DR-Terminal/bin/DR-Terminal /usr/local/bin/dr-terminal
dr-terminal connect lager --exec -c 'df -h'

单实例

DR-Terminal 为每个用户保持单个实例(Unix 域套接字,或 Windows 上的命名管道)。第二个 DR-Terminal connect ... 会把它的参数转发给运行中的实例并退出 — 运行中的实例随后打开一个新标签页。

Previous
本地与串口
Next
安全与数据