npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

remote-shell-cli

v1.0.3

Published

Execute commands on remote servers via SSH

Readme

remote-shell

通过 SSH 在远程服务器上执行命令。

功能特性

  • 单主机命令执行:在单个远程主机上执行命令
  • 实时流式输出:命令输出实时显示到终端
  • 文件上传/下载:通过 SFTP 在本地与远程之间传输文件(带进度显示)
  • 配置热重载:每次调用读取最新配置,无需重启
  • 双重认证:支持密码和私钥认证

快速开始

1. 配置主机

创建 ~/.config/remote-shell/hosts.json

{
  "hosts": {
    "gpu3070": {
      "alias": "3070",
      "host": "qfwuzrbacg7jnlyusnow.deepln.com",
      "port": 47612,
      "username": "root",
      "password": "your-password-here",
      "timeout": 5000
    }
  }
}

2. 列出主机

remote-shell list

输出:

3070GPU (3070host):
  host: qfwuzrbacg7jnlyusnow.deepln.com
  port: 47612
  username: root
  password: ******
  timeout: 5000

3. 添加主机

# 交互式(推荐)
remote-shell add

# 参数式
remote-shell add --alias 3070GPU --host 192.168.1.1 --username root --password your-password

4. 删除主机

# 直接删除
remote-shell delete 3070GPU

# 交互式选择删除
remote-shell delete

5. 执行命令

remote-shell 3070 "uptime && free -h"

输出:

18:00:14 up 11 days, 15:15,  0 user,  load average: 22.06, 22.98, 22.02
Mem: 251Gi used: 30Gi, free: 221Gi

命令行参数

remote-shell list, --hosts, -l      # 列出所有主机
remote-shell <alias> <command>       # 执行命令
remote-shell upload <alias> <local> <remote>     # 上传文件到远程主机
remote-shell download <alias> <remote> <local>   # 从远程主机下载文件
remote-shell --help, -h             # 显示帮助

示例

remote-shell 3070 "df -h"
remote-shell dev "uptime"
remote-shell upload 3070 ./model.tar.gz /root/model.tar.gz
remote-shell download 3070 /root/logs/app.log ./app.log

错误处理

当别名不存在时,会报错并显示所有可用的主机别名:

$ remote-shell nonexistent "echo test"
No hosts found for alias: nonexistent

Available hosts:
  3070GPU -> [email protected]:47612

配置说明

配置文件路径

| 路径 | 说明 | | ----------------------------------- | -------------------- | | ~/.config/remote-shell/hosts.json | 默认配置(XDG 标准) |

支持 XDG_CONFIG_HOME 环境变量自定义配置目录。

可通过 --config <path> 指定自定义配置文件。

配置字段

| 字段 | 类型 | 必填 | 默认值 | 说明 | | -------------- | ------ | ---- | ------ | -------------------- | | alias | string | 是 | - | CLI 快速访问名称 | | host | string | 是 | - | 主机名或 IP 地址 | | port | number | 否 | 22 | SSH 端口 | | username | string | 是 | - | SSH 用户名 | | password | string | 否* | - | SSH 密码 | | privateKeyPath | string | 否* | - | 私钥路径(~ 展开) | | timeout | number | 否 | 5000 | 超时时间(毫秒) |

*二选一:password 或 privateKeyPath

密码认证

{
  "hosts": {
    "gpu3070": {
      "alias": "3070",
      "host": "example.com",
      "port": 22,
      "username": "root",
      "password": "secret"
    }
  }
}

私钥认证

{
  "hosts": {
    "gpu3070": {
      "alias": "3070",
      "host": "example.com",
      "port": 22,
      "username": "root",
      "privateKeyPath": "~/.ssh/id_rsa"
    }
  }
}

安装方式

从源码构建

cd /path/to/remote-shell-cli
npm install
npm run build
./dist/remote-shell list

开发链接

cd /path/to/remote-shell-cli
npm run build
npm link
remote-shell list

添加到 PATH

cp ./dist/remote-shell ~/.local/bin/remote-shell

技术栈

| 包 | 版本 | 用途 | | ------------------------------------------ | ------- | ----------- | | ssh2 | ^1.17.0 | SSH2 客户端 | | zod | ^3.23.8 | 配置校验 |

许可证

MIT