I. 安装

1.1 自动安装

运行如下命令下载安装 go-graft 最新的版本:

1sudo sh -c "$(curl -L https://github.com/mzz2017/gg/raw/main/release/go.sh)"

📌 说明:
不使用 sudo 时,gg 将会安装到用户目录。
如果安装完毕后 gg 命令运行 失败,请检查 $PATH
你也可以创建一个到 /usr/bin 的软链接。
例如:
sudo ln -s /usr/local/bin/gg /usr/bin/gg

1.2 手动安装

1.2.1 代理下载

若你的服务器无法正常访问 github.com ,可通过以下方式下载:

1wget https://raw.githubusercontent.com/mzz2017/gg/refs/heads/main/release/go.sh

或使用 https://ghfast.top 代理访问:

1wget https://ghfast.top/https://github.com/mzz2017/gg/raw/main/release/go.sh

或通过 Raw 下载:

1wget https://ghfast.top/https://raw.githubusercontent.com/mzz2017/gg/refs/heads/main/release/go.sh

curl -O 下载:

1curl -O https://ghfast.top/https://github.com/mzz2017/gg/raw/main/release/go.sh

1.2.1 链接替换

go.sh 内的 github.com 链接替换成使用镜像的形式

1sed -i 's/github.com/ghfast.top\/github.com/g' go.sh

1.2.3 脚本安装

运行修改过的 go.sh

1sh go.sh

1.3 验证安装

1gg --version

1.4 卸载

在用户目录删除配置文件

1rm .config

删除可执行文件

1rm /usr/local/bin/gg

II. 代理配置

2.1 临时使用

2.1.1 使用订阅地址

默认情况下 gg 会从你的订阅中自动挑选第一个可用的节点:

1gg --subscription https://example.com/path/to/sub docker pull caddy

2.1.2 使用节点链接

1gg --node ss://YWVzLTEyOC1nY206MQ@example.com:17247 speedtest

2.2 长期使用

2.2.1 设置订阅地址

1gg config -w subscription=https://example.com/path/to/sub
2gg curl ipv4.appspot.com

Socks5 代理

1gg config -w node=socks5://127.0.0.1:10086

2.2.2 设置节点链接

1gg config -w node=vmess://MY_VMESS_SERVER_SHARE_LINK
2gg curl ipv4.appspot.com

2.3 进阶用法

2.3.1 列出所有配置项

1gg config

2.3.2 读取某个特定配置项

1gg config node

2.3.3 移除订阅

1gg config -w subscription=

2.3.4 移除节点

1gg config -u node

III. 进阶用法

如果您想在使用 gg 的时候能够补全其他命令,请参考以下方法:

3.1 bash

在 ~/.bashrc 加上一行:

1complete -F _command gg

IV. 参考文档

  1. mzz2017/gg: Linux 命令行代理工具 (only for linux)